
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>11 pc客户端源码分析 · 高性能服务器开发 技术专栏</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="easy_coder">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-fexa/fexa.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../libevent源码深度剖析/" />
    
    
    <link rel="prev" href="10开放一个TeamTalk测试服务器地址和几个测试账号.html" />
    

    </head>
    <body>
        
<div class="book">
	<div class="header-inner">
		<!-- LOGO -->
		<div class="logo"></div>
		<span class="title"></span>

		<!-- Search -->
		
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>


		<!-- Nav -->
		<ul class="header-nav">
			
		</ul>
	</div>

	<div class="book-summary">
		<div class="book-summary-title">文档目录</div>
		
		
		<nav role="navigation">
			


<ul class="summary">
    
    

    

    
        
        <li class="header">Part I</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../C++必知必会的知识点/">
            
                <a href="../C++必知必会的知识点/">
            
                    
                    C++必知必会的知识点
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../C++必知必会的知识点/如何成为一名合格的CC++开发者？.html">
            
                <a href="../C++必知必会的知识点/如何成为一名合格的CC++开发者？.html">
            
                    
                    如何成为一名合格的C/C++开发者？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../C++必知必会的知识点/不定参数函数实现var_arg系列的宏.html">
            
                <a href="../C++必知必会的知识点/不定参数函数实现var_arg系列的宏.html">
            
                    
                    不定参数函数实现var_arg系列的宏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../C++必知必会的知识点/你一定要搞明白的C函数调用方式与栈原理.html">
            
                <a href="../C++必知必会的知识点/你一定要搞明白的C函数调用方式与栈原理.html">
            
                    
                    你一定要搞明白的C函数调用方式与栈原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../C++必知必会的知识点/深入理解CC++中的指针.html">
            
                <a href="../C++必知必会的知识点/深入理解CC++中的指针.html">
            
                    
                    深入理解C/C++中的指针
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../C++必知必会的知识点/详解C++11中的智能指针.html">
            
                <a href="../C++必知必会的知识点/详解C++11中的智能指针.html">
            
                    
                    详解C++11中的智能指针
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../C++必知必会的知识点/C++17结构化绑定.html">
            
                <a href="../C++必知必会的知识点/C++17结构化绑定.html">
            
                    
                    C++17结构化绑定
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../C++必知必会的知识点/C++必须掌握的pimpl惯用法.html">
            
                <a href="../C++必知必会的知识点/C++必须掌握的pimpl惯用法.html">
            
                    
                    C++必须掌握的pimpl惯用法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../C++必知必会的知识点/用VisualStudio调试Linux程序.html">
            
                <a href="../C++必知必会的知识点/用VisualStudio调试Linux程序.html">
            
                    
                    用Visual Studio调试Linux程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../C++必知必会的知识点/如何使用VisualStudio管理和阅读开源项目代码.html">
            
                <a href="../C++必知必会的知识点/如何使用VisualStudio管理和阅读开源项目代码.html">
            
                    
                    如何使用Visual Studio管理和阅读开源项目代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../C++必知必会的知识点/利用cmake工具生成VisualStudio工程文件.html">
            
                <a href="../C++必知必会的知识点/利用cmake工具生成VisualStudio工程文件.html">
            
                    
                    利用cmake工具生成Visual Studio工程文件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../多线程/">
            
                <a href="../多线程/">
            
                    
                    多线程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../多线程/后台C++开发你一定要知道的条件变量.html">
            
                <a href="../多线程/后台C++开发你一定要知道的条件变量.html">
            
                    
                    后台C++开发你一定要知道的条件变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../多线程/整型变量赋值是原子操作吗？.html">
            
                <a href="../多线程/整型变量赋值是原子操作吗？.html">
            
                    
                    整型变量赋值是原子操作吗？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../网络编程/">
            
                <a href="../网络编程/">
            
                    
                    网络编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../网络编程/bind函数重难点解析.html">
            
                <a href="../网络编程/bind函数重难点解析.html">
            
                    
                    bind 函数重难点解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../网络编程/connect函数在阻塞和非阻塞模式下的行为.html">
            
                <a href="../网络编程/connect函数在阻塞和非阻塞模式下的行为.html">
            
                    
                    connect 函数在阻塞和非阻塞模式下的行为
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="../网络编程/select函数重难点解析.html">
            
                <a href="../网络编程/select函数重难点解析.html">
            
                    
                    select 函数重难点解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="../网络编程/Linuxepoll模型（含LT模式和ET模式详解）.html">
            
                <a href="../网络编程/Linuxepoll模型（含LT模式和ET模式详解）.html">
            
                    
                    Linux epoll 模型（含LT 模式和 ET 模式详解）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="../网络编程/socket的阻塞模式和非阻塞模式.html">
            
                <a href="../网络编程/socket的阻塞模式和非阻塞模式.html">
            
                    
                    socket 的阻塞模式和非阻塞模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="../网络编程/非阻塞模式下send和recv函数的返回值.html">
            
                <a href="../网络编程/非阻塞模式下send和recv函数的返回值.html">
            
                    
                    非阻塞模式下 send 和 recv 函数的返回值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="../网络编程/服务器开发通信协议设计介绍.html">
            
                <a href="../网络编程/服务器开发通信协议设计介绍.html">
            
                    
                    服务器开发通信协议设计介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="../网络编程/TCP协议如何解决粘包、半包问题.html">
            
                <a href="../网络编程/TCP协议如何解决粘包、半包问题.html">
            
                    
                    TCP 协议如何解决粘包、半包问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.9" data-path="../网络编程/网络通信中收发数据的正确姿势.html">
            
                <a href="../网络编程/网络通信中收发数据的正确姿势.html">
            
                    
                    网络通信中收发数据的正确姿势
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.10" data-path="../网络编程/服务器端发数据时，如果对端一直不收，怎么办？.html">
            
                <a href="../网络编程/服务器端发数据时，如果对端一直不收，怎么办？.html">
            
                    
                    服务器端发数据时，如果对端一直不收，怎么办？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../程序员必知必会的网络命令/">
            
                <a href="../程序员必知必会的网络命令/">
            
                    
                    程序员必知必会的网络命令
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../程序员必知必会的网络命令/利用telnet命令发电子邮件.html">
            
                <a href="../程序员必知必会的网络命令/利用telnet命令发电子邮件.html">
            
                    
                    利用telnet命令发电子邮件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="../程序员必知必会的网络命令/做Java或者C++开发都应该知道的lsof命令.html">
            
                <a href="../程序员必知必会的网络命令/做Java或者C++开发都应该知道的lsof命令.html">
            
                    
                    做Java或者C++开发都应该知道的lsof命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="../程序员必知必会的网络命令/Linux网络故障排查的瑞士军刀.html">
            
                <a href="../程序员必知必会的网络命令/Linux网络故障排查的瑞士军刀.html">
            
                    
                    Linux网络故障排查的瑞士军刀nc命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="../程序员必知必会的网络命令/Linuxtcpdump使用介绍.html">
            
                <a href="../程序员必知必会的网络命令/Linuxtcpdump使用介绍.html">
            
                    
                    Linux tcpdump使用详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5" data-path="../程序员必知必会的网络命令/从抓包的角度分析connect函数的连接过程.html">
            
                <a href="../程序员必知必会的网络命令/从抓包的角度分析connect函数的连接过程.html">
            
                    
                    从抓包的角度分析connect函数的连接过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.6" data-path="../程序员必知必会的网络命令/服务器开发中网络数据分析与故障排查经验漫谈.html">
            
                <a href="../程序员必知必会的网络命令/服务器开发中网络数据分析与故障排查经验漫谈.html">
            
                    
                    服务器开发中网络数据分析与故障排查经验漫谈
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Part II</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../高性能服务器框架设计/">
            
                <a href="../高性能服务器框架设计/">
            
                    
                    高性能服务器框架设计
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../高性能服务器框架设计/主线程与工作线程的分工.html">
            
                <a href="../高性能服务器框架设计/主线程与工作线程的分工.html">
            
                    
                    主线程与工作线程的分工
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="../高性能服务器框架设计/Reactor模式.html">
            
                <a href="../高性能服务器框架设计/Reactor模式.html">
            
                    
                    Reactor模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3" data-path="../高性能服务器框架设计/实例：一个服务器程序的架构介绍.html">
            
                <a href="../高性能服务器框架设计/实例：一个服务器程序的架构介绍.html">
            
                    
                    实例：一个服务器程序的架构介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4" data-path="../高性能服务器框架设计/错误码系统的设计.html">
            
                <a href="../高性能服务器框架设计/错误码系统的设计.html">
            
                    
                    错误码系统的设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5" data-path="../高性能服务器框架设计/日志系统的设计.html">
            
                <a href="../高性能服务器框架设计/日志系统的设计.html">
            
                    
                    日志系统的设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6" data-path="../高性能服务器框架设计/如何设计断线自动重连机制.html">
            
                <a href="../高性能服务器框架设计/如何设计断线自动重连机制.html">
            
                    
                    如何设计断线自动重连机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.7" data-path="../高性能服务器框架设计/心跳包机制设计详解.html">
            
                <a href="../高性能服务器框架设计/心跳包机制设计详解.html">
            
                    
                    心跳包机制设计详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.8" data-path="../高性能服务器框架设计/业务数据处理一定要单独开线程吗.html">
            
                <a href="../高性能服务器框架设计/业务数据处理一定要单独开线程吗.html">
            
                    
                    业务数据处理一定要单独开线程吗
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.9" data-path="../高性能服务器框架设计/C++高性能服务器网络框架设计细节.html">
            
                <a href="../高性能服务器框架设计/C++高性能服务器网络框架设计细节.html">
            
                    
                    C++ 高性能服务器网络框架设计细节
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../服务器开发案例实战/">
            
                <a href="../服务器开发案例实战/">
            
                    
                    服务器开发案例实战
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1" data-path="../服务器开发案例实战/从零实现一个http服务器.html">
            
                <a href="../服务器开发案例实战/从零实现一个http服务器.html">
            
                    
                    从零实现一个http服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2" data-path="../服务器开发案例实战/从零实现一款12306刷票软件.html">
            
                <a href="../服务器开发案例实战/从零实现一款12306刷票软件.html">
            
                    
                    从零实现一款12306刷票软件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.3" data-path="../服务器开发案例实战/从零实现一个邮件收发客户端.html">
            
                <a href="../服务器开发案例实战/从零实现一个邮件收发客户端.html">
            
                    
                    从零实现一个邮件收发客户端
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.4" data-path="../服务器开发案例实战/从零开发一个WebSocket服务器.html">
            
                <a href="../服务器开发案例实战/从零开发一个WebSocket服务器.html">
            
                    
                    从零开发一个WebSocket服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.5" data-path="../服务器开发案例实战/1从一款多人联机实时对战游戏开始.html">
            
                <a href="../服务器开发案例实战/1从一款多人联机实时对战游戏开始.html">
            
                    
                    从零学习开源项目系列（一） 从一款多人联机实时对战游戏开始
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.6" data-path="../服务器开发案例实战/2最后一战概况.html">
            
                <a href="../服务器开发案例实战/2最后一战概况.html">
            
                    
                    从零学习开源项目系列（二） 最后一战概况
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.7" data-path="../服务器开发案例实战/3CSBattleMgr服务源码研究.html">
            
                <a href="../服务器开发案例实战/3CSBattleMgr服务源码研究.html">
            
                    
                    从零学习开源项目系列（三） CSBattleMgr服务源码研究
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.8" data-path="../服务器开发案例实战/4LogServer源码探究.html">
            
                <a href="../服务器开发案例实战/4LogServer源码探究.html">
            
                    
                    从零学习开源项目系列（四）LogServer源码探究
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Part III</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="./">
            
                <a href="./">
            
                    
                    TeamTalk IM源码分析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.1" data-path="01TeamTalk介绍.html">
            
                <a href="01TeamTalk介绍.html">
            
                    
                    01 TeamTalk介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.2" data-path="02服务器端的程序的编译与部署.html">
            
                <a href="02服务器端的程序的编译与部署.html">
            
                    
                    02 服务器端的程序的编译与部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.3" data-path="03服务器端的程序架构介绍.html">
            
                <a href="03服务器端的程序架构介绍.html">
            
                    
                    03 服务器端的程序架构介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.4" data-path="04服务器端db_proxy_server源码分析.html">
            
                <a href="04服务器端db_proxy_server源码分析.html">
            
                    
                    04 服务器端db_proxy_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.5" data-path="05服务器端msg_server源码分析.html">
            
                <a href="05服务器端msg_server源码分析.html">
            
                    
                    05 服务器端msg_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.6" data-path="06服务器端login_server源码分析.html">
            
                <a href="06服务器端login_server源码分析.html">
            
                    
                    06 服务器端login_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.7" data-path="07服务器端msfs源码分析.html">
            
                <a href="07服务器端msfs源码分析.html">
            
                    
                    07 服务器端msfs源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.8" data-path="08服务器端file_server源码分析.html">
            
                <a href="08服务器端file_server源码分析.html">
            
                    
                    08 服务器端file_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.9" data-path="09服务器端route_server源码分析.html">
            
                <a href="09服务器端route_server源码分析.html">
            
                    
                    09 服务器端route_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.10" data-path="10开放一个TeamTalk测试服务器地址和几个测试账号.html">
            
                <a href="10开放一个TeamTalk测试服务器地址和几个测试账号.html">
            
                    
                    10 开放一个TeamTalk测试服务器地址和几个测试账号
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="6.1.11" data-path="11pc客户端源码分析.html">
            
                <a href="11pc客户端源码分析.html">
            
                    
                    11 pc客户端源码分析
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../libevent源码深度剖析/">
            
                <a href="../libevent源码深度剖析/">
            
                    
                    libevent源码深度剖析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1.1" data-path="../libevent源码深度剖析/libevent源码深度剖析01.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析01.html">
            
                    
                    libevent源码深度剖析01
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.2" data-path="../libevent源码深度剖析/libevent源码深度剖析02.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析02.html">
            
                    
                    libevent源码深度剖析02
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.3" data-path="../libevent源码深度剖析/libevent源码深度剖析03.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析03.html">
            
                    
                    libevent源码深度剖析03
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.4" data-path="../libevent源码深度剖析/libevent源码深度剖析04.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析04.html">
            
                    
                    libevent源码深度剖析04
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.5" data-path="../libevent源码深度剖析/libevent源码深度剖析05.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析05.html">
            
                    
                    libevent源码深度剖析05
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.6" data-path="../libevent源码深度剖析/libevent源码深度剖析06.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析06.html">
            
                    
                    libevent源码深度剖析06
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.7" data-path="../libevent源码深度剖析/libevent源码深度剖析07.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析07.html">
            
                    
                    libevent源码深度剖析07
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.8" data-path="../libevent源码深度剖析/libevent源码深度剖析08.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析08.html">
            
                    
                    libevent源码深度剖析08
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.9" data-path="../libevent源码深度剖析/libevent源码深度剖析09.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析09.html">
            
                    
                    libevent源码深度剖析09
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.10" data-path="../libevent源码深度剖析/libevent源码深度剖析10.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析10.html">
            
                    
                    libevent源码深度剖析10
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.11" data-path="../libevent源码深度剖析/libevent源码深度剖析11.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析11.html">
            
                    
                    libevent源码深度剖析11
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.12" data-path="../libevent源码深度剖析/libevent源码深度剖析12.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析12.html">
            
                    
                    libevent源码深度剖析12
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.13" data-path="../libevent源码深度剖析/libevent源码深度剖析13.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析13.html">
            
                    
                    libevent源码深度剖析13
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="../leveldb源码分析/">
            
                <a href="../leveldb源码分析/">
            
                    
                    leveldb源码分析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.2.1" data-path="../leveldb源码分析/leveldb源码分析1.html">
            
                <a href="../leveldb源码分析/leveldb源码分析1.html">
            
                    
                    leveldb源码分析1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.2" data-path="../leveldb源码分析/leveldb源码分析2.html">
            
                <a href="../leveldb源码分析/leveldb源码分析2.html">
            
                    
                    leveldb源码分析2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.3" data-path="../leveldb源码分析/leveldb源码分析3.html">
            
                <a href="../leveldb源码分析/leveldb源码分析3.html">
            
                    
                    leveldb源码分析3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.4" data-path="../leveldb源码分析/leveldb源码分析4.html">
            
                <a href="../leveldb源码分析/leveldb源码分析4.html">
            
                    
                    leveldb源码分析4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.5" data-path="../leveldb源码分析/leveldb源码分析5.html">
            
                <a href="../leveldb源码分析/leveldb源码分析5.html">
            
                    
                    leveldb源码分析5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.6" data-path="../leveldb源码分析/leveldb源码分析6.html">
            
                <a href="../leveldb源码分析/leveldb源码分析6.html">
            
                    
                    leveldb源码分析6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.7" data-path="../leveldb源码分析/leveldb源码分析7.html">
            
                <a href="../leveldb源码分析/leveldb源码分析7.html">
            
                    
                    leveldb源码分析7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.8" data-path="../leveldb源码分析/leveldb源码分析8.html">
            
                <a href="../leveldb源码分析/leveldb源码分析8.html">
            
                    
                    leveldb源码分析8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.9" data-path="../leveldb源码分析/leveldb源码分析9.html">
            
                <a href="../leveldb源码分析/leveldb源码分析9.html">
            
                    
                    leveldb源码分析9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.10" data-path="../leveldb源码分析/leveldb源码分析10.html">
            
                <a href="../leveldb源码分析/leveldb源码分析10.html">
            
                    
                    leveldb源码分析10
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.11" data-path="../leveldb源码分析/leveldb源码分析11.html">
            
                <a href="../leveldb源码分析/leveldb源码分析11.html">
            
                    
                    leveldb源码分析11
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.12" data-path="../leveldb源码分析/leveldb源码分析12.html">
            
                <a href="../leveldb源码分析/leveldb源码分析12.html">
            
                    
                    leveldb源码分析12
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.13" data-path="../leveldb源码分析/leveldb源码分析13.html">
            
                <a href="../leveldb源码分析/leveldb源码分析13.html">
            
                    
                    leveldb源码分析13
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.14" data-path="../leveldb源码分析/leveldb源码分析14.html">
            
                <a href="../leveldb源码分析/leveldb源码分析14.html">
            
                    
                    leveldb源码分析14
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.15" data-path="../leveldb源码分析/leveldb源码分析15.html">
            
                <a href="../leveldb源码分析/leveldb源码分析15.html">
            
                    
                    leveldb源码分析15
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.16" data-path="../leveldb源码分析/leveldb源码分析16.html">
            
                <a href="../leveldb源码分析/leveldb源码分析16.html">
            
                    
                    leveldb源码分析16
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.17" data-path="../leveldb源码分析/leveldb源码分析17.html">
            
                <a href="../leveldb源码分析/leveldb源码分析17.html">
            
                    
                    leveldb源码分析17
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.18" data-path="../leveldb源码分析/leveldb源码分析18.html">
            
                <a href="../leveldb源码分析/leveldb源码分析18.html">
            
                    
                    leveldb源码分析18
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.19" data-path="../leveldb源码分析/leveldb源码分析19.html">
            
                <a href="../leveldb源码分析/leveldb源码分析19.html">
            
                    
                    leveldb源码分析19
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.20" data-path="../leveldb源码分析/leveldb源码分析20.html">
            
                <a href="../leveldb源码分析/leveldb源码分析20.html">
            
                    
                    leveldb源码分析20
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.21" data-path="../leveldb源码分析/leveldb源码分析21.html">
            
                <a href="../leveldb源码分析/leveldb源码分析21.html">
            
                    
                    leveldb源码分析21
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.22" data-path="../leveldb源码分析/leveldb源码分析22.html">
            
                <a href="../leveldb源码分析/leveldb源码分析22.html">
            
                    
                    leveldb源码分析22
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="8.1" data-path="../Memcached源码分析/">
            
                <a href="../Memcached源码分析/">
            
                    
                    Memcached源码分析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.1" data-path="../Memcached源码分析/00服务器资源调整.html">
            
                <a href="../Memcached源码分析/00服务器资源调整.html">
            
                    
                    00 服务器资源调整
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.2" data-path="../Memcached源码分析/01初始化参数解析.html">
            
                <a href="../Memcached源码分析/01初始化参数解析.html">
            
                    
                    01 初始化参数解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.3" data-path="../Memcached源码分析/02网络监听的建立.html">
            
                <a href="../Memcached源码分析/02网络监听的建立.html">
            
                    
                    02 网络监听的建立
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4" data-path="../Memcached源码分析/03网络连接建立.html">
            
                <a href="../Memcached源码分析/03网络连接建立.html">
            
                    
                    03 网络连接建立
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.5" data-path="../Memcached源码分析/04内存初始化.html">
            
                <a href="../Memcached源码分析/04内存初始化.html">
            
                    
                    04 内存初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.6" data-path="../Memcached源码分析/05资源初始化.html">
            
                <a href="../Memcached源码分析/05资源初始化.html">
            
                    
                    05 资源初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.7" data-path="../Memcached源码分析/06get过程.html">
            
                <a href="../Memcached源码分析/06get过程.html">
            
                    
                    06 get过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.8" data-path="../Memcached源码分析/07cas属性.html">
            
                <a href="../Memcached源码分析/07cas属性.html">
            
                    
                    07 cas属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.9" data-path="../Memcached源码分析/08内存池.html">
            
                <a href="../Memcached源码分析/08内存池.html">
            
                    
                    08 内存池
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.10" data-path="../Memcached源码分析/09连接队列.html">
            
                <a href="../Memcached源码分析/09连接队列.html">
            
                    
                    09 连接队列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.11" data-path="../Memcached源码分析/10Hash表操作.html">
            
                <a href="../Memcached源码分析/10Hash表操作.html">
            
                    
                    10 Hash表操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.12" data-path="../Memcached源码分析/12set操作.html">
            
                <a href="../Memcached源码分析/12set操作.html">
            
                    
                    12 set操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.13" data-path="../Memcached源码分析/13do_item_alloc操作.html">
            
                <a href="../Memcached源码分析/13do_item_alloc操作.html">
            
                    
                    13 do_item_alloc操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.14" data-path="../Memcached源码分析/14item结构.html">
            
                <a href="../Memcached源码分析/14item结构.html">
            
                    
                    14 item结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.15" data-path="../Memcached源码分析/15Hash表扩容.html">
            
                <a href="../Memcached源码分析/15Hash表扩容.html">
            
                    
                    15 Hash表扩容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.16" data-path="../Memcached源码分析/16线程交互.html">
            
                <a href="../Memcached源码分析/16线程交互.html">
            
                    
                    16 线程交互
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.17" data-path="../Memcached源码分析/17状态机.html">
            
                <a href="../Memcached源码分析/17状态机.html">
            
                    
                    17 状态机
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="9.1" data-path="../游戏开发专题/">
            
                <a href="../游戏开发专题/">
            
                    
                    游戏开发专题
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1.1" data-path="../游戏开发专题/1游戏服务器开发的基本体系与服务器端开发的一些建议.html">
            
                <a href="../游戏开发专题/1游戏服务器开发的基本体系与服务器端开发的一些建议.html">
            
                    
                    1 游戏服务器开发的基本体系与服务器端开发的一些建议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2" data-path="../游戏开发专题/2网络游戏服务器开发框架设计介绍.html">
            
                <a href="../游戏开发专题/2网络游戏服务器开发框架设计介绍.html">
            
                    
                    2 网络游戏服务器开发框架设计介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3" data-path="../游戏开发专题/3游戏后端开发需要掌握的知识.html">
            
                <a href="../游戏开发专题/3游戏后端开发需要掌握的知识.html">
            
                    
                    3 游戏后端开发需要掌握的知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.4" data-path="../游戏开发专题/4关于游戏服务端架构的整理.html">
            
                <a href="../游戏开发专题/4关于游戏服务端架构的整理.html">
            
                    
                    4 关于游戏服务端架构的整理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.5" data-path="../游戏开发专题/5各类游戏对应的服务端架构.html">
            
                <a href="../游戏开发专题/5各类游戏对应的服务端架构.html">
            
                    
                    5 各类游戏对应的服务端架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.6" data-path="../游戏开发专题/6从腾讯QQgame高性能服务器集群架构看“分而治之”与“自治”等分布式架构设计原则.html">
            
                <a href="../游戏开发专题/6从腾讯QQgame高性能服务器集群架构看“分而治之”与“自治”等分布式架构设计原则.html">
            
                    
                    6 从腾讯QQgame高性能服务器集群架构看“分而治之”与“自治”等分布式架构设计原则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.7" data-path="../游戏开发专题/7QQ游戏百万人同时在线服务器架构实现.html">
            
                <a href="../游戏开发专题/7QQ游戏百万人同时在线服务器架构实现.html">
            
                    
                    7 QQ游戏百万人同时在线服务器架构实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.8" data-path="../游戏开发专题/8大型多人在线游戏服务器架构设计.html">
            
                <a href="../游戏开发专题/8大型多人在线游戏服务器架构设计.html">
            
                    
                    8 大型多人在线游戏服务器架构设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.9" data-path="../游戏开发专题/9百万用户级游戏服务器架构设计.html">
            
                <a href="../游戏开发专题/9百万用户级游戏服务器架构设计.html">
            
                    
                    9 百万用户级游戏服务器架构设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.10" data-path="../游戏开发专题/10十万在线的WebGame的数据库设计思路.html">
            
                <a href="../游戏开发专题/10十万在线的WebGame的数据库设计思路.html">
            
                    
                    10 十万在线的WebGame的数据库设计思路
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.11" data-path="../游戏开发专题/11一种高性能网络游戏服务器架构设计.html">
            
                <a href="../游戏开发专题/11一种高性能网络游戏服务器架构设计.html">
            
                    
                    11 一种高性能网络游戏服务器架构设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.12" data-path="../游戏开发专题/12经典游戏服务器端架构概述.html">
            
                <a href="../游戏开发专题/12经典游戏服务器端架构概述.html">
            
                    
                    12 经典游戏服务器端架构概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.13" data-path="../游戏开发专题/13游戏跨服架构进化之路.html">
            
                <a href="../游戏开发专题/13游戏跨服架构进化之路.html">
            
                    
                    13 游戏跨服架构进化之路
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Part IV</li>
        
        
    
        <li class="chapter " data-level="10.1" data-path="../程序员面试题精讲/">
            
                <a href="../程序员面试题精讲/">
            
                    
                    程序员面试题精讲
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.1.1" data-path="../程序员面试题精讲/腾讯后台开发实习生技能要求.html">
            
                <a href="../程序员面试题精讲/腾讯后台开发实习生技能要求.html">
            
                    
                    腾讯后台开发实习生技能要求
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.1.2" data-path="../程序员面试题精讲/聊聊如何拿大厂的offer.html">
            
                <a href="../程序员面试题精讲/聊聊如何拿大厂的offer.html">
            
                    
                    聊聊如何拿大厂的 offer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.1.3" data-path="../程序员面试题精讲/网络通信题目集锦.html">
            
                <a href="../程序员面试题精讲/网络通信题目集锦.html">
            
                    
                    网络通信题目集锦
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.1.4" data-path="../程序员面试题精讲/我面试后端开发经理的经历.html">
            
                <a href="../程序员面试题精讲/我面试后端开发经理的经历.html">
            
                    
                    我面试后端开发经理的经历
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.1.5" data-path="../程序员面试题精讲/LinuxCC++后端开发面试问哪些问题.html">
            
                <a href="../程序员面试题精讲/LinuxCC++后端开发面试问哪些问题.html">
            
                    
                    Linux C/C++后端开发面试问哪些问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.2" data-path="../职业规划/">
            
                <a href="../职业规划/">
            
                    
                    职业规划
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.2.1" data-path="../职业规划/给工作4年迷茫的程序员们的一点建议.html">
            
                <a href="../职业规划/给工作4年迷茫的程序员们的一点建议.html">
            
                    
                    给工作 4 年迷茫的程序员们的一点建议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.2.2" data-path="../职业规划/聊聊技术人员的常见的职业问题.html">
            
                <a href="../职业规划/聊聊技术人员的常见的职业问题.html">
            
                    
                    聊聊技术人员的常见的职业问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.2.3" data-path="../职业规划/写给那些傻傻想做服务器开发的朋友.html">
            
                <a href="../职业规划/写给那些傻傻想做服务器开发的朋友.html">
            
                    
                    写给那些傻傻想做服务器开发的朋友
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.3" data-path="../自我提升与开源代码/">
            
                <a href="../自我提升与开源代码/">
            
                    
                    自我提升与开源代码
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.3.1" data-path="../自我提升与开源代码/2020年好好读一读开源代码吧.html">
            
                <a href="../自我提升与开源代码/2020年好好读一读开源代码吧.html">
            
                    
                    2020 年好好读一读开源代码吧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.4" data-path="../后端开发相关的书籍/">
            
                <a href="../后端开发相关的书籍/">
            
                    
                    后端开发相关的书籍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.4.1" data-path="../后端开发相关的书籍/后台开发应该读的书.html">
            
                <a href="../后端开发相关的书籍/后台开发应该读的书.html">
            
                    
                    后台开发应该读的书
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.5" data-path="../程序员的简历/">
            
                <a href="../程序员的简历/">
            
                    
                    程序员的简历
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.5.1" data-path="../程序员的简历/程序员如何写简历.html">
            
                <a href="../程序员的简历/程序员如何写简历.html">
            
                    
                    程序员如何写简历
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.6" data-path="../程序员的薪资与年终奖那些事儿/">
            
                <a href="../程序员的薪资与年终奖那些事儿/">
            
                    
                    程序员的薪资与年终奖那些事儿
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.6.1" data-path="../程序员的薪资与年终奖那些事儿/技术面试与HR谈薪资技巧.html">
            
                <a href="../程序员的薪资与年终奖那些事儿/技术面试与HR谈薪资技巧.html">
            
                    
                    技术面试与HR谈薪资技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.6.2" data-path="../程序员的薪资与年终奖那些事儿/聊一聊程序员如何增加收入.html">
            
                <a href="../程序员的薪资与年终奖那些事儿/聊一聊程序员如何增加收入.html">
            
                    
                    聊一聊程序员如何增加收入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.6.3" data-path="../程序员的薪资与年终奖那些事儿/谈一谈年终奖.html">
            
                <a href="../程序员的薪资与年终奖那些事儿/谈一谈年终奖.html">
            
                    
                    谈一谈年终奖
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.7" data-path="../程序员的烦心事/">
            
                <a href="../程序员的烦心事/">
            
                    
                    程序员的烦心事
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.7.1" data-path="../程序员的烦心事/拒绝了一家公司的offer后，他们的副总和hr总监同时打电话来询问拒绝原因并极力要求加入，我该不该去？.html">
            
                <a href="../程序员的烦心事/拒绝了一家公司的offer后，他们的副总和hr总监同时打电话来询问拒绝原因并极力要求加入，我该不该去？.html">
            
                    
                    拒绝了一家公司的offer后，他们的副总和hr总监同时打电话来询问拒绝原因并极力要求加入，我该不该去？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.7.2" data-path="../程序员的烦心事/我是一名程序员，结婚时女友要求我用两年的工资作为彩礼，我该不该答应？.html">
            
                <a href="../程序员的烦心事/我是一名程序员，结婚时女友要求我用两年的工资作为彩礼，我该不该答应？.html">
            
                    
                    我是一名程序员，结婚时女友要求我用两年的工资作为彩礼，我该不该答应？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.8" data-path="../作者的故事/">
            
                <a href="../作者的故事/">
            
                    
                    作者的故事
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.8.1" data-path="../作者的故事/我的2019.html">
            
                <a href="../作者的故事/我的2019.html">
            
                    
                    我的 2019
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.8.2" data-path="../作者的故事/我是如何年薪五十万的.html">
            
                <a href="../作者的故事/我是如何年薪五十万的.html">
            
                    
                    我是如何年薪五十万的
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


		</nav>
		
		
	</div>

	<!-- Content nav -->
	<div class="book-anchor">
		<div class="book-anchor-title">在这篇文章中:</div>
		<div class="book-anchor-body">

		</div>
	</div>

	<div class="book-body">
		
		<div class="body-inner">
			
			

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >11 pc客户端源码分析</a>
    </h1>
</div>




			<div class="page-wrapper" tabindex="-1" role="main">
				<div class="page-inner">
					
<div id="book-search-results">
    <div class="search-noresults">
    
					<section class="normal markdown-section">
						
						<div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#11-pc&#x5BA2;&#x6237;&#x7AEF;&#x6E90;&#x7801;&#x5206;&#x6790;"><b></b>11 pc&#x5BA2;&#x6237;&#x7AEF;&#x6E90;&#x7801;&#x5206;&#x6790;</a></li><ul><ul><li><span class="title-icon "></span><a href="#&#x4E00;&#x3001;&#x7A0B;&#x5E8F;&#x529F;&#x80FD;"><b></b>&#x4E00;&#x3001;&#x7A0B;&#x5E8F;&#x529F;&#x80FD;</a></li><li><span class="title-icon "></span><a href="#&#x4E8C;&#x3001;&#x7F16;&#x8BD1;&#x65B9;&#x6CD5;&#x4E0E;&#x9879;&#x76EE;&#x5DE5;&#x7A0B;&#x6587;&#x4EF6;&#x4ECB;&#x7ECD;"><b></b>&#x4E8C;&#x3001;&#x7F16;&#x8BD1;&#x65B9;&#x6CD5;&#x4E0E;&#x9879;&#x76EE;&#x5DE5;&#x7A0B;&#x6587;&#x4EF6;&#x4ECB;&#x7ECD;</a></li><li><span class="title-icon "></span><a href="#&#x4E09;&#x3001;&#x7A0B;&#x5E8F;&#x603B;&#x4F53;&#x6846;&#x67B6;&#x4ECB;&#x7ECD;"><b></b>&#x4E09;&#x3001;&#x7A0B;&#x5E8F;&#x603B;&#x4F53;&#x6846;&#x67B6;&#x4ECB;&#x7ECD;</a></li><li><span class="title-icon "></span><a href="#&#x56DB;&#x3001;&#x7A0B;&#x5E8F;&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x6BD4;&#x8F83;&#x6709;&#x610F;&#x601D;&#x7684;&#x6280;&#x5DE7;&#x6458;&#x5F55;"><b></b>&#x56DB;&#x3001;&#x7A0B;&#x5E8F;&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x6BD4;&#x8F83;&#x6709;&#x610F;&#x601D;&#x7684;&#x6280;&#x5DE7;&#x6458;&#x5F55;</a></li></ul></ul></ul></div><h1 id="11-pc&#x5BA2;&#x6237;&#x7AEF;&#x6E90;&#x7801;&#x5206;&#x6790;"><a name="11-pc&#x5BA2;&#x6237;&#x7AEF;&#x6E90;&#x7801;&#x5206;&#x6790;" class="anchor-navigation-ex-anchor" href="#11-pc&#x5BA2;&#x6237;&#x7AEF;&#x6E90;&#x7801;&#x5206;&#x6790;"><i class="fa fa-link" aria-hidden="true"></i></a>11 pc&#x5BA2;&#x6237;&#x7AEF;&#x6E90;&#x7801;&#x5206;&#x6790;</h1>
<p><strong>&#x2014;&#x2014;&#x5199;&#x5728;&#x524D;&#x9762;&#x7684;&#x8BDD;</strong> </p>
<p>&#x5728;&#x8981;&#x4E0D;&#x8981;&#x5199;&#x8FD9;&#x7BC7;&#x6587;&#x7AE0;&#x7684;&#x7EA0;&#x7ED3;&#x4E2D;&#x6323;&#x624E;&#x4E86;&#x597D;&#x4E45;&#xFF0C;&#x5C31;&#x6211;&#x4E2A;&#x4EBA;&#x800C;&#x5DF2;&#xFF0C;&#x6211;&#x63A5;&#x89E6;windows&#x7F16;&#x7A0B;&#xFF0C;&#x5DF2;&#x7ECF;&#x516D;&#x4E03;&#x4E2A;&#x5E74;&#x5934;&#x4E86;&#xFF0C;&#x5C24;&#x5176;&#x662F;&#x5728;&#x6211;&#x8BFB;&#x7814;&#x7684;&#x4E09;&#x5E74;&#x5185;&#xFF0C;&#x57FA;&#x672C;&#x5FC3;&#x601D;&#x90FD;&#x662F;&#x82B1;&#x5728;&#x5B66;&#x4E60;&#x548C;&#x7814;&#x7A76;windows&#x7A0B;&#x5E8F;&#x4E0A;&#x4E86;&#x3002;&#x6211;&#x5F88;&#x5E86;&#x5E78;&#x6211;&#x5F53;&#x521D;&#x5B66;&#x4E60;windows&#x7A0B;&#x5E8F;&#x8D70;&#x4E86;&#x4E00;&#x6761;&#x6B63;&#x786E;&#x7684;&#x8DEF;&#x7EBF;&#xFF1A;&#x5148;&#x662F;&#x5B66;&#x4E60;&#x5E38;&#x7528;&#x7684;windows&#x7A0B;&#x5E8F;&#x539F;&#x7406;&#x548C;&#x57FA;&#x672C;API&#xFF0C;&#x518D;&#x5B66;&#x4E60;&#x7684;mfc&#x3001;wtl&#x7B49;&#x4E00;&#x4E9B;&#x5E38;&#x7528;&#x7684;&#x6846;&#x67B6;&#x548C;&#x7C7B;&#x5E93;&#xFF0C;&#x540C;&#x65F6;&#x770B;&#x4E86;&#x5927;&#x91CF;windows&#x9879;&#x76EE;&#x7684;&#x6E90;&#x7801;&#xFF0C;&#x5982;&#x91D1;&#x5C71;&#x536B;&#x58EB;&#x7684;&#x5F00;&#x6E90;&#x4EE3;&#x7801;&#x3001;filezilla&#x3001;&#x7535;&#x9A74;&#x6E90;&#x7801;&#x7B49;&#x7B49;&#x3002;&#x4E2A;&#x4EBA;&#x89C9;&#x5F97;&#xFF0C;&#x57FA;&#x7840;&#x771F;&#x7684;&#x5F88;&#x91CD;&#x8981;&#xFF0C;&#x62FF;windows&#x5F00;&#x53D1;&#x6765;&#x8BF4;&#xFF0C;&#x5F53;&#x4F60;&#x638C;&#x63E1;&#x4E86;windows&#x7684;&#x7A0B;&#x5E8F;&#x7684;&#x57FA;&#x672C;&#x539F;&#x7406;&#xFF0C;&#x6211;&#x5217;&#x4E00;&#x4E0B;&#x5927;&#x81F4;&#x8303;&#x56F4;&#xFF1A;</p>
<ol>
<li><p>windows&#x6D88;&#x606F;&#x673A;&#x5236;&#xFF08;&#x6D88;&#x606F;&#x5982;&#x4F55;&#x4EA7;&#x751F;&#x3001;&#x5982;&#x4F55;&#x53D1;&#x9001;&#x3001;&#x5982;&#x4F55;&#x5904;&#x7406;&#xFF0C;&#x5E38;&#x89C1;&#x7684;&#x6D88;&#x606F;&#x6709;&#x54EA;&#x4E9B;&#x3001;&#x6D88;&#x606F;&#x7684;&#x4F18;&#x5148;&#x7EA7;&#x3001;&#x5982;&#x4F55;&#x81EA;&#x5B9A;&#x4E49;&#x6D88;&#x606F;&#x3001;&#x7A97;&#x4F53;&#x6D88;&#x606F;&#x3001;&#x5E38;&#x7528;&#x63A7;&#x4EF6;&#x6D88;&#x606F;&#xFF09;</p>
</li>
<li><p>gdi&#x539F;&#x7406;&#xFF08;&#x8981;&#x719F;&#x6089;gdi&#x7684;&#x5404;&#x79CD;&#x5BF9;&#x8C61;&#xFF0C;&#x5982;&#x753B;&#x7B14;&#x3001;&#x753B;&#x5237;&#x3001;&#x5B57;&#x4F53;&#x3001;&#x533A;&#x57DF;&#x3001;&#x88C1;&#x526A;&#x3001;&#x4F4D;&#x56FE;&#x7B49;&#xFF0C;&#x719F;&#x6089;&#x5B83;&#x4EEC;&#x7684;API&#xFF0C;&#x719F;&#x6089;&#x5404;&#x79CD;gdi&#x7ED8;&#x56FE;API&#x3001;&#x5F53;&#x7136;&#x6700;&#x597D;&#x4E5F;&#x8981;&#x719F;&#x6089;&#x4E00;&#x6574;&#x5957;&#x7684;gdi+&#x7684;&#x7C7B;&#xFF0C;gdi&#x4E0E;gdi+&#x7684;&#x533A;&#x522B;&#xFF09;</p>
</li>
<li><p>windows&#x8FDB;&#x7A0B;&#x4E0E;&#x7EBF;&#x7A0B;&#x7684;&#x6982;&#x5FF5;&#xFF08;&#x8FDB;&#x7A0B;&#x7684;&#x6982;&#x5FF5;&#x3001;&#x5982;&#x4F55;&#x521B;&#x5EFA;&#x3001;&#x5982;&#x4F55;&#x7ED3;&#x675F;&#x3001;&#x8DE8;&#x8FDB;&#x7A0B;&#x5982;&#x4F55;&#x901A;&#x4FE1;&#xFF1B;&#x7EBF;&#x7A0B;&#x7684;&#x521B;&#x5EFA;&#x4E0E;&#x9500;&#x6BC1;&#x3001;&#x7EBF;&#x7A0B;&#x95F4;&#x7684;&#x540C;&#x6B65;&#x4E0E;&#x8D44;&#x6E90;&#x4FDD;&#x62A4;&#xFF0C;&#x719F;&#x6089;windows&#x5E38;&#x7528;&#x7684;&#x7EBF;&#x7A0B;&#x540C;&#x6B65;&#x5BF9;&#x8C61;&#xFF1A;&#x4E34;&#x754C;&#x533A;&#x3001;&#x4E8B;&#x4EF6;&#x3001;&#x4E92;&#x65A5;&#x4F53;&#x3001;&#x4FE1;&#x53F7;&#x91CF;&#x7B49;&#xFF09;</p>
</li>
<li><p>windows&#x5185;&#x5B58;&#x7BA1;&#x7406;&#xFF08;&#x6E05;&#x6670;&#x5730;&#x638C;&#x63E1;&#x4E00;&#x4E2A;&#x8FDB;&#x7A0B;&#x5730;&#x5740;&#x7A7A;&#x95F4;&#x7684;&#x5185;&#x5B58;&#x5206;&#x5E03;&#x3001;windows&#x5806;&#x7684;&#x521B;&#x5EFA;&#x4E0E;&#x7BA1;&#x7406;&#x7B49;&#xFF09;</p>
</li>
<li><p>dll&#x6280;&#x672F;&#xFF08;dll&#x7684;&#x751F;&#x6210;&#x3001;&#x53D8;&#x91CF;&#x7684;&#x5BFC;&#x51FA;&#x3001;&#x51FD;&#x6570;&#x7684;&#x5BFC;&#x51FA;&#x3001;&#x7C7B;&#x7684;&#x5BFC;&#x51FA;&#x3001;&#x5982;&#x4F55;&#x67E5;&#x770B;dll&#x5BFC;&#x51FA;&#x54EA;&#x4E9B;&#x51FD;&#x6570;&#x3001;&#x9690;&#x5F0F;dll&#x7684;&#x52A0;&#x8F7D;&#x3001;&#x663E;&#x793A;dll&#x7684;&#x52A0;&#x8F7D;&#x3001;&#x8FDC;&#x7A0B;dll&#x6CE8;&#x5165;&#x6280;&#x672F;&#x7B49;&#xFF09;</p>
</li>
<li><p>PE&#x6587;&#x4EF6;&#xFF08;&#x4E00;&#x4E2A;PE&#x6587;&#x4EF6;&#x7684;&#x7ED3;&#x6784;&#x3001;&#x6709;&#x54EA;&#x4E9B;&#x8282;&#x3001;&#x5982;&#x4F55;&#x4FEE;&#x6539;&#x3001;&#x5206;&#x522B;&#x6620;&#x5C04;&#x5230;&#x8FDB;&#x7A0B;&#x5730;&#x5740;&#x7A7A;&#x95F4;&#x7684;&#x4EC0;&#x4E48;&#x4F4D;&#x7F6E;&#x7B49;&#xFF09;</p>
</li>
<li><p>windows SEH&#xFF08;&#x7ED3;&#x6784;&#x5316;&#x5F02;&#x5E38;&#x5904;&#x7406;&#xFF09;</p>
</li>
<li><p>windows socket&#x7F16;&#x7A0B;</p>
</li>
<li><p>windows&#x8BFB;&#x5199;&#x6587;&#x4EF6;&#x6280;&#x672F;&#xFF08;&#x50CF;CreateFile&#x3001;WriteFile&#x3001;GetFileSize&#x7B49;&#x8FD9;&#x4E9B;API&#x5E94;&#x8BE5;&#x719F;&#x7EC3;&#x638C;&#x63E1;&#x3001;&#x5185;&#x5B58;&#x6620;&#x5C04;&#x6280;&#x672F;&#xFF09;</p>
</li>
</ol>
<p>&#x5F53;&#x7136;&#x5F88;&#x591A;&#x5FC5;&#x5907;&#x7684;&#x6280;&#x672F;&#x4E5F;&#x4E0D;&#x597D;&#x5F52;&#x7C7B;&#x5230;windows&#x6280;&#x672F;&#x4E0B;&#x9762;&#xFF0C;&#x6BD4;&#x5982;socket&#x7F16;&#x7A0B;&#xFF0C;&#x8FD9;&#x6D89;&#x53CA;&#x5230;&#x5F88;&#x591A;&#x7F51;&#x7EDC;&#x7684;&#x77E5;&#x8BC6;&#xFF0C;&#x6BD4;&#x5982;tcp&#x7684;&#x4E09;&#x6B21;&#x63E1;&#x624B;&#xFF0C;&#x6570;&#x636E;&#x7684;&#x6536;&#x53D1;&#x7B49;&#xFF0C;&#x8FD8;&#x6709;&#x5C31;&#x662F;&#x5404;&#x79CD;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x7684;&#x77E5;&#x8BC6;&#x3001;&#x4EE5;&#x53CA;&#x4E4B;&#x95F4;&#x7684;&#x76F8;&#x4E92;&#x8F6C;&#x6362;&#xFF0C;&#x53C8;&#x6BD4;&#x5982;&#x4E00;&#x7CFB;&#x5217;&#x7684;CRT&#x51FD;&#x6570;&#x53CA;&#x5176;&#x5BF9;&#x5E94;&#x7684;&#x5BBD;&#x5B57;&#x7B26;&#x7248;&#x672C;&#x3002;&#x5F53;&#x7136;&#x5982;&#x679C;&#x4F60;&#x641E;windows&#x5F00;&#x53D1;&#xFF0C;&#x4E00;&#x5B9A;&#x8981;&#x719F;&#x6089;&#x5F00;&#x53D1;&#x5DE5;&#x5177;Visual Studio&#xFF0C;&#x719F;&#x6089;&#x5176;&#x5DE5;&#x7A0B;&#x9879;&#x76EE;&#x7684;&#x5927;&#x591A;&#x6570;&#x5C5E;&#x6027;&#x914D;&#x7F6E;&#xFF0C;&#x800C;&#x4E14;&#x8981;&#x505A;&#x5230;&#x77E5;&#x5176;&#x7136;&#x4E5F;&#x77E5;&#x5176;&#x6240;&#x4EE5;&#x7136;&#x3002;&#x5982;&#x679C;&#x4E0D;&#x662F;&#x4E0D;&#x80FD;&#x8DE8;&#x5E73;&#x53F0;&#xFF0C;&#x6211;&#x6562;&#x8BF4;VS&#x662F;&#x53F2;&#x4E0A;&#x6700;&#x597D;&#x6700;&#x5F3A;&#x5927;&#x7684;&#x5F00;&#x53D1;&#x5DE5;&#x5177;&#xFF0C;&#x6CA1;&#x6709;&#x4E4B;&#x4E00;&#xFF01;&#x6211;&#x5DF2;&#x7ECF;&#x6709;&#x597D;&#x51E0;&#x5E74;&#x5E74;&#x4E0D;&#x505A;windows&#x5F00;&#x53D1;&#x4E86;&#xFF0C;&#x76EE;&#x524D;&#x4E3B;&#x8981;&#x4ECE;&#x4E8B;linux&#x5F00;&#x53D1;&#xFF0C;&#x4F46;windows&#x7684;&#x5F88;&#x591A;&#x8BBE;&#x8BA1;&#x601D;&#x60F3;&#x771F;&#x7684;&#x5F88;&#x597D;&#xFF0C;&#x975E;&#x5E38;&#x503C;&#x5F97;&#x501F;&#x9274;&#xFF0C;&#x800C;&#x4E14;&#x4ECE;&#x7F16;&#x7801;&#x98CE;&#x683C;&#x6765;&#x8BF4;&#xFF0C;&#x867D;&#x7136;&#x770B;&#x8D77;&#x6765;&#x6709;&#x70B9;&#x602A;&#x5F02;&#xFF0C;&#x4F46;&#x662F;&#x975E;&#x5E38;&#x89C4;&#x8303;&#x548C;&#x6613;&#x61C2;&#x3002;</p>
<p>&#x6709;&#x4E86;&#x57FA;&#x7840;&#x77E5;&#x8BC6;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x8F7B;&#x677E;&#x5730;&#x5BF9;&#x5DE5;&#x4F5C;&#x4E2D;&#x7684;&#x4E00;&#x4E9B;&#x95EE;&#x9898;&#x7ED9;&#x51FA;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;&#x4E5F;&#x80FD;&#x8F7B;&#x677E;&#x9605;&#x8BFB;&#x548C;&#x4F7F;&#x7528;&#x5E02;&#x9762;&#x4E0A;&#x7684;&#x90A3;&#x4E9B;&#x5E93;&#xFF0C;&#x6BD4;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x6DF1;&#x523B;&#x7406;&#x89E3;windows GDI&#xFF0C;&#x4F60;&#x4E0D;&#x4F1A;&#x5728;&#x4E00;&#x4E2A;&#x7FA4;&#x91CC;&#x5927;&#x558A;&#xFF0C;duilib&#x67D0;&#x4E2A;&#x5C5E;&#x6027;&#x4E3A;&#x4EC0;&#x4E48;&#x4E0D;&#x8D77;&#x4F5C;&#x7528;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x53BB;&#x9605;&#x8BFB;&#x5B83;&#x7684;&#x753B;&#x6CD5;&#x4EE3;&#x7801;&#xFF0C;&#x5982;&#x679C;&#x662F;bug&#x4F60;&#x53EF;&#x4EE5;&#x6539;bug&#xFF0C;&#x5982;&#x679C;&#x53EA;&#x662F;&#x4F60;&#x4F7F;&#x7528;&#x9519;&#x8BEF;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x4E86;&#x89E3;&#x5230;&#x6B63;&#x786E;&#x7684;&#x4F7F;&#x7528;&#x65B9;&#x6CD5;&#x3002;&#x6240;&#x4EE5;&#x57FA;&#x7840;&#x8FD9;&#x4E2A;&#x4E1C;&#x897F;&#xFF0C;&#x5728;&#x77ED;&#x65F6;&#x95F4;&#x5185;&#xFF0C;&#x53EF;&#x80FD;&#x8BA9;&#x4F60;&#x770B;&#x4E0D;&#x51FA;&#x4E0E;&#x5176;&#x4ED6;&#x4EBA;&#x7684;&#x5DEE;&#x522B;&#xFF0C;&#x4F46;&#x662F;&#x4ECE;&#x957F;&#x8FDC;&#x6765;&#x770B;&#xFF0C;&#x5B83;&#x51B3;&#x5B9A;&#x7740;&#x4F60;&#x5728;&#x6280;&#x672F;&#x4E0A;&#x8D70;&#x7684;&#x9AD8;&#x5EA6;&#x4E0E;&#x6DF1;&#x5EA6;&#x3002;&#x5957;&#x7528;&#x4FAF;&#x6377;&#x5148;&#x751F;&#x7684;&#x4E00;&#x53E5;&#x8BDD;&#xFF1A;&#x52FF;&#x5728;&#x6D6E;&#x6C99;&#x7B51;&#x9AD8;&#x53F0;&#x3002;</p>
<p><strong>&#x2014;&#x2014; &#x6B63;&#x9898;</strong></p>
<p>&#x4E0A;&#x9762;&#x7B80;&#x5355;&#x5730;&#x4ECB;&#x7ECD;&#x4E86;&#x4E0B;&#xFF0C;&#x6211;&#x4E2A;&#x4EBA;&#x5B66;&#x4E60;windows&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#x7684;&#x4E00;&#x4E9B;&#x5FC3;&#x5F97;&#x5427;&#x3002;&#x626F;&#x7684;&#x6709;&#x70B9;&#x8FDC;&#x4E86;&#xFF0C;&#x8BA9;&#x6211;&#x4EEC;&#x56DE;&#x5230;&#x6B63;&#x9898;&#x4E0A;&#x6765;&#xFF0C;&#x6765;&#x5206;&#x6790;TeamTalk&#x7684;&#x6E90;&#x7801;&#x5427;&#x3002;&#x5F53;&#x7136;&#x8FD9;&#x7BC7;&#x6587;&#x7AE0;&#x4E0E;&#x524D;&#x9762;&#x4ECB;&#x7ECD;&#x7684;&#x4E0D;&#x4E00;&#x6837;&#xFF0C;&#x6211;&#x4EEC;&#x4E0D;&#x4EC5;&#x4ECB;&#x7ECD;&#x7A0B;&#x5E8F;&#x7684;&#x6B63;&#x9898;&#x8BBE;&#x8BA1;&#x601D;&#x8DEF;&#xFF0C;&#x8FD8;&#x4F1A;&#x4ECB;&#x7ECD;&#x4E00;&#x4E9B;&#x6709;&#x610F;&#x4E49;&#x7684;&#x7EC6;&#x8282;&#xFF0C;&#x6BD4;&#x5982;&#x4E00;&#x4E9B;windows&#x5F00;&#x53D1;&#x4E2D;&#x5E38;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x7EC6;&#x8282;&#x3002;</p>
<h3 id="&#x4E00;&#x3001;&#x7A0B;&#x5E8F;&#x529F;&#x80FD;"><a name="&#x4E00;&#x3001;&#x7A0B;&#x5E8F;&#x529F;&#x80FD;" class="anchor-navigation-ex-anchor" href="#&#x4E00;&#x3001;&#x7A0B;&#x5E8F;&#x529F;&#x80FD;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E00;&#x3001;&#x7A0B;&#x5E8F;&#x529F;&#x80FD;</h3>
<p>&#x6211;&#x4EEC;&#x6765;&#x5148;&#x770B;&#x4E0B;TeamTalk pc&#x5BA2;&#x6237;&#x7AEF;&#x5305;&#x62EC;&#x54EA;&#x4E9B;&#x529F;&#x80FD;&#xFF1A;TeamTalk&#x56E0;&#x4E3A;&#x5F00;&#x53D1;&#x7684;&#x521D;&#x8877;&#x662F;&#x7528;&#x4E8E;&#x4F01;&#x4E1A;&#x5185;&#x90E8;&#x7684;&#x5373;&#x65F6;&#x901A;&#x8BAF;&#x8F6F;&#x4EF6;&#xFF0C;&#x6240;&#x4EE5;&#xFF0C;&#x4E0D;&#x63D0;&#x4F9B;&#x5BF9;&#x5916;&#x6CE8;&#x518C;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x4E00;&#x4E2A;&#x5458;&#x5DE5;&#x7684;&#x52A0;&#x5165;&#x4E00;&#x822C;&#x662F;&#x4EBA;&#x4E8B;&#x90E8;&#x95E8;&#x5728;&#x540E;&#x53F0;&#x7BA1;&#x7406;&#x7CFB;&#x7EDF;&#x6765;&#x65B0;&#x589E;&#x8BE5;&#x5458;&#x5DE5;&#x4FE1;&#x606F;&#x3002;&#x5176;&#x529F;&#x80FD;&#x5305;&#x62EC;&#x767B;&#x5F55;&#x3001;&#x804A;&#x5929;&#x3001;&#x7FA4;&#x804A;&#x548C;&#x5EFA;&#x8BA8;&#x8BBA;&#x7EC4;&#xFF0C;&#x5F53;&#x7136;&#x804A;&#x5929;&#x8FC7;&#x7A0B;&#x4E2D;&#x53EF;&#x4EE5;&#x53D1;&#x6587;&#x5B57;&#x3001;&#x8868;&#x60C5;&#x3001;&#x56FE;&#x7247;&#x548C;&#x6587;&#x4EF6;&#xFF0C;&#x8FD8;&#x5305;&#x62EC;&#x67E5;&#x770B;&#x804A;&#x5929;&#x8BB0;&#x5F55;&#x548C;&#x7B80;&#x5355;&#x5730;&#x67E5;&#x770B;&#x67D0;&#x4E2A;&#x5458;&#x5DE5;&#x7684;&#x4E2A;&#x4EBA;&#x4FE1;&#x606F;&#xFF0C;&#x4E1A;&#x52A1;&#x529F;&#x80FD;&#x5176;&#x5B9E;&#x4E0D;&#x591A;&#x7684;&#x3002;&#x4E0B;&#x9762;&#x662F;&#x4E00;&#x4E9B;&#x529F;&#x80FD;&#x622A;&#x56FE;&#xFF1A;</p>
<p><img src="../imgs/tt16.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p><img src="../imgs/tt17.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p><img src="../imgs/tt18.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p><img src="../imgs/tt19.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p><img src="../imgs/tt20.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p><img src="../imgs/tt21.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p><img src="../imgs/tt22.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<h3 id="&#x4E8C;&#x3001;&#x7F16;&#x8BD1;&#x65B9;&#x6CD5;&#x4E0E;&#x9879;&#x76EE;&#x5DE5;&#x7A0B;&#x6587;&#x4EF6;&#x4ECB;&#x7ECD;"><a name="&#x4E8C;&#x3001;&#x7F16;&#x8BD1;&#x65B9;&#x6CD5;&#x4E0E;&#x9879;&#x76EE;&#x5DE5;&#x7A0B;&#x6587;&#x4EF6;&#x4ECB;&#x7ECD;" class="anchor-navigation-ex-anchor" href="#&#x4E8C;&#x3001;&#x7F16;&#x8BD1;&#x65B9;&#x6CD5;&#x4E0E;&#x9879;&#x76EE;&#x5DE5;&#x7A0B;&#x6587;&#x4EF6;&#x4ECB;&#x7ECD;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E8C;&#x3001;&#x7F16;&#x8BD1;&#x65B9;&#x6CD5;&#x4E0E;&#x9879;&#x76EE;&#x5DE5;&#x7A0B;&#x6587;&#x4EF6;&#x4ECB;&#x7ECD;</h3>
<ol>
<li><p>TeamTalk&#x7684;pc&#x5BA2;&#x6237;&#x7AEF;&#x7684;&#x4E0B;&#x8F7D;&#x5730;&#x5740;&#x662F;&#xFF1A;<a href="https://github.com/baloonwj/TeamTalk" target="_blank">https://github.com/baloonwj/TeamTalk</a></p>
<p>&#x4EE3;&#x7801;&#x5305;&#x62EC;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x4EE3;&#x7801;&#x3001;pc&#x7AEF;&#x3001;mac&#x7AEF;&#x3001;&#x5B89;&#x5353;&#x548C;IOS&#x7AEF;&#xFF0C;&#x8FD8;&#x6709;web&#x7AEF;&#x6240;&#x6709;&#x4EE3;&#x7801;&#x3002;</p>
<p>pc&#x5BA2;&#x6237;&#x7AEF;&#x4EE3;&#x7801;&#x7684;&#x7F16;&#x8BD1;&#x65B9;&#x6CD5;&#x5F88;&#x7B80;&#x5355;&#xFF1A;&#x7528;VS2013&#x6253;&#x5F00;win-client\solution&#x76EE;&#x5F55;&#x4E0B;&#x7684;teamtalk.sln&#xFF0C;&#x7F16;&#x8BD1;&#x5373;&#x53EF;&#x3002;&#x4F60;&#x7684;VS&#x7248;&#x672C;&#x81F3;&#x5C11;&#x8981;&#x662F;VS2013&#xFF0C;&#x56E0;&#x4E3A;&#x4EE3;&#x7801;&#x4E2D;&#x5927;&#x91CF;&#x4F7F;&#x7528;&#x4E86;C++11&#x7684;&#x4E1C;&#x897F;&#xFF0C;VS2013&#x4EE5;&#x4E0B;&#x7248;&#x672C;&#x662F;&#x4E0D;&#x652F;&#x6301;C++11&#x7684;&#x8BED;&#x6CD5;&#x7684;&#x3002;&#x5F53;&#x7136;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x662F;VS2015&#x7684;&#x8BDD;&#xFF0C;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x8FD9;&#x7BC7;&#x6587;&#x7AE0;&#x6765;&#x8FDB;&#x884C;&#x4FEE;&#x6539;&#x548C;&#x7F16;&#x8BD1;&#xFF1A;<a href="http://www.07net01.com/linux/2017/01/1795569.html" target="_blank">http://www.07net01.com/linux/2017/01/1795569.html</a></p>
</li>
</ol>
<p>&#x6253;&#x5F00;teamtalk.sln&#x4E4B;&#x540E;&#xFF0C;&#x603B;&#x5171;&#x6709;10&#x4E2A;&#x89E3;&#x51B3;&#x65B9;&#x6CD5;&#xFF0C;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF1A;</p>
<p><img src="../imgs/tt23.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p>&#x5176;&#x4E2D;teamtalk&#x662F;&#x4E3B;&#x5DE5;&#x7A0B;&#xFF0C;&#x4F60;&#x5E94;&#x8BE5;&#x5C06;&#x5B83;&#x8BBE;&#x7F6E;&#x6210;&#x542F;&#x52A8;&#x5DE5;&#x7A0B;&#xFF0C;&#x7F16;&#x8BD1;&#x5B8C;&#x6210;&#x4E4B;&#x540E;&#x5C31;&#x53EF;&#x4EE5;&#x8C03;&#x8BD5;&#x4E86;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x81EA;&#x5DF1;&#x914D;&#x7F6E;&#x670D;&#x52A1;&#x5668;&#x6765;&#x8FDE;&#x63A5;&#x8FDB;&#x884C;&#x8C03;&#x8BD5;&#xFF0C;&#x6211;&#x4E5F;&#x53EF;&#x4EE5;&#x8FDE;&#x63A5;&#x6211;&#x7684;&#x6D4B;&#x8BD5;&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x5177;&#x4F53;&#x53C2;&#x89C1;<a href="http://blog.csdn.net/analogous_love/article/details/72723704" target="_blank">&#x300A;TeamTalk&#x6E90;&#x7801;&#x5206;&#x6790;&#xFF08;&#x5341;&#xFF09; &#x2014;&#x2014; &#x5F00;&#x653E;&#x4E00;&#x4E2A;TeamTalk&#x6D4B;&#x8BD5;&#x670D;&#x52A1;&#x5668;&#x5730;&#x5740;&#x548C;&#x51E0;&#x4E2A;&#x6D4B;&#x8BD5;&#x8D26;&#x53F7;&#x300B;</a>&#x3002;&#x4E0B;&#x9762;&#x5148;&#x5927;&#x81F4;&#x4ECB;&#x7ECD;&#x4E00;&#x4E2A;&#x5404;&#x4E2A;&#x5DE5;&#x7A0B;&#x7684;&#x4F5C;&#x7528;&#xFF1A;</p>
<ol>
<li><p>Duilib&#x662F;teamtalk&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x6B3E;&#x5F00;&#x6E90;&#x754C;&#x9762;&#x5E93;&#xFF0C;&#x8BE5;&#x754C;&#x9762;&#x5E93;&#x6A21;&#x4EFF;web&#x5F00;&#x53D1;&#x4E2D;&#x7684;&#x5E03;&#x5C40;&#x6280;&#x672F;&#xFF0C;&#x4F7F;&#x7528;xml&#x6587;&#x4EF6;&#x6765;&#x5E03;&#x5C40;windows&#x754C;&#x9762;&#xFF0C;&#x5E76;&#x4E14;&#x5728;&#x4E3B;&#x7A97;&#x53E3;&#x4E0A;&#x7ED8;&#x5236;&#x6240;&#x6709;&#x5B50;&#x63A7;&#x4EF6;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x6240;&#x8C13;&#x7684;directUI&#x6280;&#x672F;&#xFF1B;</p>
</li>
<li><p>GifSmiley&#x662F;&#x7A0B;&#x5E8F;&#x4E2D;&#x7528;&#x6765;&#x89E3;&#x6790;&#x548C;&#x663E;&#x793A;gif&#x683C;&#x5F0F;&#x7684;&#x56FE;&#x7247;&#x7684;&#x5E93;&#xFF0C;&#x4EE5;&#x652F;&#x6301;gif&#x56FE;&#x7247;&#x7684;&#x52A8;&#x753B;&#x6548;&#x679C;&#xFF1B;</p>
</li>
<li><p>httpclient&#x529F;&#x80FD;&#x662F;&#x7A0B;&#x5E8F;&#x4E2D;&#x4F7F;&#x7528;&#x7684;http&#x8BF7;&#x6C42;&#x5E93;&#xFF0C;&#x767B;&#x5F55;&#x524D;&#x7A0B;&#x5E8F;&#x4F1A;&#x5148;&#x8FDE;&#x63A5;&#x670D;&#x52A1;&#x5668;&#x7684;login_server&#x4EE5;&#x83B7;&#x5F97;&#x540E;&#x7EED;&#x9700;&#x8981;&#x767B;&#x5F55;&#x7684;msg_server&#x7684;ip&#x5730;&#x5740;&#x548C;&#x7AEF;&#x53E3;&#x53F7; &#x7B49;&#x4FE1;&#x606F;&#xFF0C;&#x8FD9;&#x91CC;&#x5C31;&#x662F;&#x4F7F;&#x7528;&#x7684;http&#x534F;&#x8BAE;&#xFF0C;&#x540C;&#x65F6;&#x804A;&#x5929;&#x8FC7;&#x7A0B;&#x4E2D;&#x6536;&#x53D1;&#x7684;&#x804A;&#x5929;&#x56FE;&#x7247;&#x4E0E;&#x56FE;&#x7247;&#x670D;&#x52A1;&#x5668;msfs&#x4E5F;&#x4F7F;&#x7528;http&#x534F;&#x8BAE;&#x6765;&#x6536;&#x53D1;&#x8FD9;&#x4E9B;&#x56FE;&#x7247;&#xFF1B;</p>
</li>
<li><p>libogg&#x662F;&#x4E00;&#x4E2A;&#x8BED;&#x97F3;&#x5E93;&#xFF0C;&#x7528;&#x6765;&#x89E3;&#x6790;&#x58F0;&#x97F3;&#x6587;&#x4EF6;&#x7684;&#xFF0C;&#x56E0;&#x4E3A;pc&#x5BA2;&#x6237;&#x7AEF;&#x53EF;&#x80FD;&#x4F1A;&#x6536;&#x5230;&#x79FB;&#x52A8;&#x7AEF;&#x7684;&#x8BED;&#x97F3;&#x804A;&#x5929;&#xFF0C;&#x76F8;&#x6BD4;&#x8F83;&#x4F20;&#x7EDF;&#x7684;<em>.wav&#x3001;</em>.mp3&#x3001;<em>.wma&#xFF0C;</em>.ogg&#x683C;&#x5F0F;&#x7684;&#x4E0D;&#x4EC5;&#x97F3;&#x8D28;&#x9AD8;&#xFF0C;&#x800C;&#x4E14;&#x97F3;&#x9891;&#x6587;&#x4EF6;&#x7684;&#x4F53;&#x79EF;&#x5C0F;&#xFF0C;&#x817E;&#x8BAF;&#x7684;QQ&#x6E38;&#x620F;&#x82F1;&#x96C4;&#x6740;&#x4E2D;&#x7684;&#x8BED;&#x97F3;&#x4E5F;&#x662F;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x683C;&#x5F0F;&#x7684;&#x3002;</p>
</li>
<li><p>libspeex&#x662F;&#x4E00;&#x4E2A;&#x97F3;&#x9891;&#x538B;&#x7F29;&#x5E93;&#xFF1B;</p>
</li>
<li><p>Modules&#x5C31;&#x662F;TeamTalk&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x5404;&#x79CD;&#x5E93;&#x4E86;&#xFF0C;&#x5C55;&#x5F00;&#x6765;&#x770B;&#x4E0B;&#x4F60;&#x5C31;&#x660E;&#x767D;&#x4E86;&#xFF1A;</p>
</li>
</ol>
<p><img src="../imgs/tt24.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<ol>
<li><p>network&#x662F;teamtalk&#x4F7F;&#x7528;&#x7684;&#x7F51;&#x7EDC;&#x901A;&#x4FE1;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x5176;&#x5B9E;teamtalk pc&#x7AEF;&#x548C;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x4F7F;&#x7528;&#x7684;&#x662F;&#x540C;&#x4E00;&#x5957;&#x7F51;&#x7EDC;&#x901A;&#x4FE1;&#x5E93;&#xFF0C;&#x53EA;&#x4E0D;&#x8FC7;&#x5982;&#x679C;&#x670D;&#x52A1;&#x5668;&#x8FD0;&#x884C;&#x5728;linux&#x4E0B;&#xFF0C;&#x5176;&#x6838;&#x5FC3;&#x7684;IO&#x590D;&#x7528;&#x6A21;&#x578B;&#x662F;epoll&#xFF0C;&#x800C;pc&#x5BA2;&#x6237;&#x7AEF;&#x4F7F;&#x7528;&#x7684;IO&#x590D;&#x7528;&#x6A21;&#x578B;&#x662F;select&#xFF1B;</p>
</li>
<li><p>speexdec &#x4E5F;&#x662F;&#x548C;ogg&#x683C;&#x5F0F;&#x76F8;&#x5173;&#x7684;&#x7F16;&#x7801;&#x548C;&#x89E3;&#x7801;&#x5668;&#xFF1B;</p>
</li>
<li><p>teamtalk&#x662F;&#x4E3B;&#x7A0B;&#x5E8F;&#x5165;&#x53E3;&#x5DE5;&#x7A0B;&#xFF1B;</p>
</li>
<li><p>utility&#x5305;&#x542B;&#x4E86;teamtalk&#x4E2D;&#x7528;&#x5230;&#x7684;&#x4E00;&#x4E9B;&#x5DE5;&#x5177;&#x7C7B;&#x5DE5;&#x7A0B;&#xFF0C;&#x6BD4;&#x5982;sqlite&#x7684;&#x5305;&#x88C5;&#x63A5;&#x53E3;&#x3001;md5&#x5DE5;&#x5177;&#x7C7B;&#x7B49;&#x3002;</p>
</li>
</ol>
<p>&#x9664;&#x4E86;&#x4E0A;&#x9762;&#x4ECB;&#x7ECD;&#x7684;&#x4E00;&#x4E9B;&#x5E93;&#x4EE5;&#x5916;&#xFF0C;&#x7A0B;&#x5E8F;&#x8FD8;&#x4F7F;&#x7528;&#x4E86;sqlite&#x5E93;&#x3001;&#x8C37;&#x6B4C;protobuf&#x5E93;&#x3001;&#x65E5;&#x5FD7;&#x5E93;yaolog&#x7B49;&#x3002;&#x5173;&#x4E8E;yaolog&#x53EF;&#x53C2;&#x89C1;<a href="http://blog.csdn.net/gemo/article/details/8499692&#xFF0C;&#x8FD9;&#x4E2A;&#x65E5;&#x5FD7;&#x5E93;&#x6BD4;&#x8F83;&#x6709;&#x610F;&#x601D;&#x7684;&#x5730;&#x65B9;&#x662F;&#x53EF;&#x4EE5;&#x5355;&#x72EC;&#x6253;&#x5370;&#x51FA;&#x7F51;&#x7EDC;&#x901A;&#x4FE1;&#x4E2D;&#x7684;&#x5B57;&#x8282;&#x6D41;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x5F62;&#x5F0F;&#xFF0C;&#x63A8;&#x8350;&#x4E00;&#x4E0B;&#xFF0C;&#x6548;&#x679C;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF08;&#x4F4D;&#x4E8E;win-client\bin\teamtalk\Debug\log\socket.log&#x6587;&#x4EF6;&#x4E2D;&#xFF09;&#xFF1A;" target="_blank">http://blog.csdn.net/gemo/article/details/8499692&#xFF0C;&#x8FD9;&#x4E2A;&#x65E5;&#x5FD7;&#x5E93;&#x6BD4;&#x8F83;&#x6709;&#x610F;&#x601D;&#x7684;&#x5730;&#x65B9;&#x662F;&#x53EF;&#x4EE5;&#x5355;&#x72EC;&#x6253;&#x5370;&#x51FA;&#x7F51;&#x7EDC;&#x901A;&#x4FE1;&#x4E2D;&#x7684;&#x5B57;&#x8282;&#x6D41;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x5F62;&#x5F0F;&#xFF0C;&#x63A8;&#x8350;&#x4E00;&#x4E0B;&#xFF0C;&#x6548;&#x679C;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF08;&#x4F4D;&#x4E8E;win-client\bin\teamtalk\Debug\log\socket.log&#x6587;&#x4EF6;&#x4E2D;&#xFF09;&#xFF1A;</a></p>
<p><img src="../imgs/tt25.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<h3 id="&#x4E09;&#x3001;&#x7A0B;&#x5E8F;&#x603B;&#x4F53;&#x6846;&#x67B6;&#x4ECB;&#x7ECD;"><a name="&#x4E09;&#x3001;&#x7A0B;&#x5E8F;&#x603B;&#x4F53;&#x6846;&#x67B6;&#x4ECB;&#x7ECD;" class="anchor-navigation-ex-anchor" href="#&#x4E09;&#x3001;&#x7A0B;&#x5E8F;&#x603B;&#x4F53;&#x6846;&#x67B6;&#x4ECB;&#x7ECD;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E09;&#x3001;&#x7A0B;&#x5E8F;&#x603B;&#x4F53;&#x6846;&#x67B6;&#x4ECB;&#x7ECD;</h3>
<p>&#x6574;&#x4E2A;&#x7A0B;&#x5E8F;&#x4F7F;&#x7528;&#x4E86;mfc&#x6846;&#x67B6;&#x6765;&#x505A;&#x4E00;&#x4E2A;&#x67B6;&#x5B50;&#xFF0C;&#x800C;&#x6240;&#x6709;&#x7684;&#x7A97;&#x53E3;&#x548C;&#x5BF9;&#x8BDD;&#x6846;&#x90FD;&#x4F7F;&#x7528;&#x7684;&#x662F;duilib&#xFF0C;&#x5173;&#x4E8E;duilib&#x7F51;&#x4E0A;&#x6709;&#x5F88;&#x591A;&#x8D44;&#x6599;&#xFF0C;&#x8FD9;&#x91CC;&#x4E0D;&#x4ECB;&#x7ECD;duilib&#x7EC6;&#x8282;&#x7684;&#x4E1C;&#x897F;&#x4E86;&#x3002;&#x4E00;&#x4E2A;mfc&#x7A0B;&#x5E8F;&#x6846;&#x67B6;&#xFF0C;&#x4F7F;&#x7528;&#x8D77;&#x6765;&#x4E5F;&#x5F88;&#x7B80;&#x5355;&#xFF0C;&#x5C31;&#x662F;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;&#x7C7B;&#x96C6;&#x6210;mfc&#x7684;CWinApp&#x7C7B;&#xFF0C;&#x5E76;&#x6539;&#x5199;&#x5176;InitInstance()&#x65B9;&#x6CD5;&#xFF0C;mfc&#x5185;&#x90E8;&#x4F1A;&#x66FF;&#x6211;&#x4EEC;&#x505A;&#x597D;&#x6D88;&#x606F;&#x5FAA;&#x73AF;&#x7684;&#x6B65;&#x9AA4;&#x3002;TeamTalk&#x76F8;&#x5173;&#x7684;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token comment">//&#x4F4D;&#x4E8E;teamtalk.h&#x4E2D;</span>
<span class="token keyword">class</span> <span class="token class-name">CteamtalkApp</span> <span class="token operator">:</span> <span class="token base-clause"><span class="token keyword">public</span> <span class="token class-name">CWinApp</span></span>
<span class="token punctuation">{</span>
<span class="token keyword">public</span><span class="token operator">:</span>
    <span class="token function">CteamtalkApp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">public</span><span class="token operator">:</span>
    <span class="token keyword">virtual</span> BOOL <span class="token function">InitInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">virtual</span> BOOL <span class="token function">ExitInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">private</span><span class="token operator">:</span>
    <span class="token comment">/**
     *  &#x521B;&#x5EFA;&#x7528;&#x6237;&#x76EE;&#x5F55;
     *
     * @return  BOOL
     * @exception there is no any exception to throw.
     */</span>    
    BOOL <span class="token function">_CreateUsersFolder</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">/**
     * &#x521B;&#x5EFA;&#x4E3B;&#x7A97;&#x53E3;
     *
     * @return  BOOL
     * @exception there is no any exception to throw.
     */</span>    
    BOOL <span class="token function">_CreateMainDialog</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">/**
    * &#x9500;&#x6BC1;&#x4E3B;&#x7A97;&#x53E3;
    *
    * @return  BOOL
    * @exception there is no any exception to throw.
    */</span>
    BOOL <span class="token function">_DestroyMainDialog</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">/**
    * &#x5224;&#x65AD;&#x662F;&#x5426;&#x662F;&#x5355;&#x5B9E;&#x4F8B;
    *
    * @return  BOOL
    * @exception there is no any exception to throw.
    */</span>
    BOOL <span class="token function">_IsHaveInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">void</span> <span class="token function">_InitLog</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">private</span><span class="token operator">:</span>
    MainDialog<span class="token operator">*</span>                        m_pMainDialog<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x5728;teamtalk.cpp&#x4E2D;&#x5B9A;&#x4E49;&#x4E86;&#x552F;&#x4E00;&#x7684;&#x5168;&#x5C40;&#x5BF9;&#x8C61;CteamtalkApp&#x5BF9;&#x8C61;&#xFF1A;</p>
<p><img src="../imgs/tt26.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p>&#x63A5;&#x7740;&#xFF0C;&#x6240;&#x6709;&#x7684;&#x521D;&#x59CB;&#x5316;&#x5DE5;&#x4F5C;&#x5C31;&#x662F;&#x5199;&#x5728;CteamtalkApp::InitInstance()&#x65B9;&#x6CD5;&#x4E2D;&#x4E86;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">BOOL <span class="token class-name">CteamtalkApp</span><span class="token operator">::</span><span class="token function">InitInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    INITCOMMONCONTROLSEX InitCtrls<span class="token punctuation">;</span>
    InitCtrls<span class="token punctuation">.</span>dwSize <span class="token operator">=</span> <span class="token keyword">sizeof</span><span class="token punctuation">(</span>InitCtrls<span class="token punctuation">)</span><span class="token punctuation">;</span>
    InitCtrls<span class="token punctuation">.</span>dwICC <span class="token operator">=</span> ICC_WIN95_CLASSES<span class="token punctuation">;</span>
    <span class="token function">InitCommonControlsEx</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>InitCtrls<span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//log init</span>
    <span class="token function">_InitLog</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">// Verify that the version of the library that we linked against is</span>
    <span class="token comment">// compatible with the version of the headers we compiled against.</span>
    GOOGLE_PROTOBUF_VERIFY_VERSION<span class="token punctuation">;</span>

    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;===================================VersionNO:%d======BulidTime&#xFF1A;%s--%s==========================&quot;</span><span class="token punctuation">)</span>
        <span class="token punctuation">,</span> TEAMTALK_VERSION<span class="token punctuation">,</span> util<span class="token operator">::</span><span class="token function">utf8ToCString</span><span class="token punctuation">(</span><span class="token constant">__DATE__</span><span class="token punctuation">)</span><span class="token punctuation">,</span> util<span class="token operator">::</span><span class="token function">utf8ToCString</span><span class="token punctuation">(</span><span class="token constant">__TIME__</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>__super<span class="token operator">::</span><span class="token function">InitInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;__super::InitInstance failed.&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> FALSE<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token function">AfxEnableControlContainer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//&#x4E3A;&#x4E86;&#x8C03;&#x8BD5;&#x65B9;&#x4FBF;&#xFF0C;&#x6682;&#x4E14;&#x6CE8;&#x91CA;&#x6389;</span>
    <span class="token comment">//if (_IsHaveInstance())</span>
    <span class="token comment">//{</span>
    <span class="token comment">//    LOG__(ERR, _T(&quot;Had one instance,this will exit&quot;));</span>
    <span class="token comment">//    HWND hwndMain = FindWindow(_T(&quot;TeamTalkMainDialog&quot;), NULL);</span>
    <span class="token comment">//    if (hwndMain)</span>
    <span class="token comment">//    {</span>
    <span class="token comment">//        ::SendMessage(hwndMain, WM_START_MOGUTALKINSTANCE, NULL, NULL);</span>
    <span class="token comment">//    }</span>
    <span class="token comment">//    return FALSE;</span>
    <span class="token comment">//}</span>

    <span class="token comment">//start imcore lib</span>
    <span class="token comment">//&#x5728;&#x8FD9;&#x91CC;&#x542F;&#x52A8;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x548C;&#x7F51;&#x7EDC;IO&#x7EBF;&#x7A0B;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>imcore<span class="token operator">::</span><span class="token function">IMLibCoreRunEvent</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;start imcore lib failed!&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;start imcore lib done&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//start ui event</span>
    <span class="token comment">//&#x5728;&#x8FD9;&#x91CC;&#x521B;&#x5EFA;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x5E76;&#x542F;&#x52A8;&#x5B9A;&#x65F6;&#x5668;&#x5B9A;&#x65F6;&#x5904;&#x7406;&#x4EFB;&#x52A1;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>module<span class="token operator">::</span><span class="token function">getEventManager</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">startup</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">!=</span> imcore<span class="token operator">::</span>IMCORE_OK<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;start ui event failed&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;start ui event done&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//create user folders</span>
    <span class="token function">_CreateUsersFolder</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//duilib&#x521D;&#x59CB;&#x5316;</span>
    <span class="token class-name">CPaintManagerUI</span><span class="token operator">::</span><span class="token function">SetInstance</span><span class="token punctuation">(</span><span class="token function">AfxGetInstanceHandle</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token class-name">CPaintManagerUI</span><span class="token operator">::</span><span class="token function">SetResourcePath</span><span class="token punctuation">(</span><span class="token class-name">CPaintManagerUI</span><span class="token operator">::</span><span class="token function">GetInstancePath</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;..\\gui\\&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">//track&#x8FD9;&#x4E2A;&#x8BBE;&#x7F6E;&#x4E86;&#x8DEF;&#x5F84;&#xFF0C;&#x4F1A;&#x5BFC;&#x81F4;base&#x91CC;&#x8BBE;&#x7F6E;&#x7684;&#x65E0;&#x6548;&#x3002;</span>
    <span class="token operator">::</span><span class="token function">CoInitialize</span><span class="token punctuation">(</span><span class="token constant">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token operator">::</span><span class="token function">OleInitialize</span><span class="token punctuation">(</span><span class="token constant">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//&#x65E0;&#x9700;&#x914D;&#x7F6E;server</span>
    module<span class="token operator">::</span>TTConfig<span class="token operator">*</span> pCfg <span class="token operator">=</span> module<span class="token operator">::</span><span class="token function">getSysConfigModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getSystemConfig</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>pCfg <span class="token operator">&amp;&amp;</span> pCfg<span class="token operator">-&gt;</span>loginServIP<span class="token punctuation">.</span><span class="token function">IsEmpty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>module<span class="token operator">::</span><span class="token function">getSysConfigModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">showServerConfigDialog</span><span class="token punctuation">(</span><span class="token constant">NULL</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;server config canceled&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">return</span> FALSE<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>module<span class="token operator">::</span><span class="token function">getLoginModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">showLoginDialog</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;login canceled&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> FALSE<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;login success&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//&#x521B;&#x5EFA;&#x4E3B;&#x7A97;&#x53E3;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token function">_CreateMainDialog</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;Create MianDialog failed&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> FALSE<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;Create MianDialog done&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token class-name">CPaintManagerUI</span><span class="token operator">::</span><span class="token function">MessageLoop</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token class-name">CPaintManagerUI</span><span class="token operator">::</span><span class="token function">Term</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">return</span> TRUE<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x4E0A;&#x8FF0;&#x4EE3;&#x7801;&#x5927;&#x81F4;&#x505A;&#x4E86;&#x4EE5;&#x4E0B;&#x5DE5;&#x4F5C;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token comment">// 1. &#x521D;&#x59CB;&#x5316;yaolog&#x65E5;&#x5FD7;&#x5E93;</span>

<span class="token comment">// 2. google protobuf&#x7684;&#x7248;&#x672C;&#x53F7;&#x68C0;&#x6D4B;</span>

<span class="token comment">// 3. &#x542F;&#x52A8;&#x7F51;&#x7EDC;&#x901A;&#x4FE1;&#x7EBF;&#x7A0B;&#x68C0;&#x6D4B;&#x7F51;&#x7EDC;&#x6570;&#x636E;&#x8BFB;&#x5199;&#xFF0C;&#x518D;&#x542F;&#x52A8;&#x4E00;&#x4E2A;&#x7EBF;&#x7A0B;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x961F;&#x5217;&#xFF0C;&#x5982;&#x679C;&#x961F;&#x5217;&#x4E2D;&#x6709;&#x4EFB;&#x52A1;&#xFF0C;&#x5219;&#x53D6;&#x51FA;&#x8BE5;&#x4EFB;&#x52A1;&#x6267;&#x884C;</span>

<span class="token comment">// 4. &#x521B;&#x5EFA;&#x652F;&#x7EBF;&#x7A0B;&#x4E0E;UI&#x7EBF;&#x7A0B;&#x7684;&#x6865;&#x6881;&#x2014;&#x2014;&#x4EE3;&#x7406;&#x7A97;&#x53E3;</span>

<span class="token comment">// 5. &#x521B;&#x5EFA;&#x7528;&#x6237;&#x6587;&#x4EF6;&#x5939;</span>

<span class="token comment">// 6. &#x914D;&#x7F6E;duilib&#x7684;&#x8D44;&#x6E90;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;&#x3001;&#x521D;&#x59CB;&#x5316;com&#x5E93;&#x3001;&#x521D;&#x59CB;&#x5316;ole&#x5E93; </span>

<span class="token comment">// 7. &#x5982;&#x679C;&#x6CA1;&#x6709;&#x914D;&#x7F6E;&#x767B;&#x5F55;&#x670D;&#x52A1;&#x5668;&#x7684;&#x5730;&#x5740;&#xFF0C;&#x5219;&#x663E;&#x793A;&#x914D;&#x7F6E;&#x5BF9;&#x8BDD;&#x6846;</span>

<span class="token comment">// 8. &#x663E;&#x793A;&#x767B;&#x5F55;&#x5BF9;&#x8BDD;&#x6846;</span>

<span class="token comment">// 9. &#x767B;&#x5F55;&#x6210;&#x529F;&#x540E;&#xFF0C;&#x767B;&#x5F55;&#x5BF9;&#x8BDD;&#x6846;&#x9500;&#x6BC1;&#xFF0C;&#x663E;&#x793A;&#x4E3B;&#x5BF9;&#x8BDD;&#x6846;</span>

<span class="token comment">// 10. &#x542F;&#x52A8;duilib&#x7684;&#x6D88;&#x606F;&#x5FAA;&#x73AF;&#xFF08;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#x4E0D;&#x4F7F;&#x7528;mfc&#x7684;&#x6D88;&#x606F;&#x5FAA;&#x73AF;&#xFF09;</span>
</code></pre>
<p>&#x5176;&#x5B83;&#x7684;&#x6CA1;&#x4EC0;&#x4E48;&#x597D;&#x4ECB;&#x7ECD;&#x7684;&#xFF0C;&#x6211;&#x4EEC;&#x6765;&#x91CD;&#x70B9;&#x4ECB;&#x7ECD;&#x4E0B;&#x7B2C;3&#x70B9;&#x548C;&#x7B2C;4&#x70B9;&#x3002;&#x5148;&#x8BF4;&#x7B2C;3&#x70B9;&#xFF0C;&#x5728;&#x7B2C;3&#x70B9;&#x4E2D;&#x53C8;&#x4F1A;&#x7275;&#x626F;&#x51FA;&#x7B2C;4&#x70B9;&#xFF0C;&#x7F51;&#x7EDC;&#x901A;&#x4FE1;&#x7EBF;&#x7A0B;&#x7684;&#x542F;&#x52A8;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token comment">//start imcore lib</span>
<span class="token comment">//&#x5728;&#x8FD9;&#x91CC;&#x542F;&#x52A8;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x548C;&#x7F51;&#x7EDC;IO&#x7EBF;&#x7A0B;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>imcore<span class="token operator">::</span><span class="token function">IMLibCoreRunEvent</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;start imcore lib failed!&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;start imcore lib done&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;start imcore lib failed!&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;start imcore lib done&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">bool</span> <span class="token function">IMLibCoreRunEvent</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>    
    <span class="token function">LOG__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;===============================================================================&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//&#x5728;&#x8FD9;&#x91CC;&#x542F;&#x52A8;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x5904;&#x7406;&#x7EBF;&#x7A0B;</span>
    <span class="token function">getOperationManager</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">startup</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    CAutoLock <span class="token function">lock</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>g_lock<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token function">netlib_is_running</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">ifdef</span> <span class="token expression">_MSC_VER</span></span>
        <span class="token keyword">unsigned</span> <span class="token keyword">int</span> m_dwThreadID<span class="token punctuation">;</span>
        <span class="token comment">//&#x5728;&#x8FD9;&#x91CC;&#x542F;&#x52A8;&#x7F51;&#x7EDC;IO&#x7EBF;&#x7A0B;</span>
        g_hThreadHandle <span class="token operator">=</span> <span class="token punctuation">(</span>HANDLE<span class="token punctuation">)</span><span class="token function">_beginthreadex</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> event_run<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token keyword">unsigned</span><span class="token operator">*</span><span class="token punctuation">)</span><span class="token operator">&amp;</span>m_dwThreadID<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>g_hThreadHandle <span class="token operator">&lt;</span> <span class="token punctuation">(</span>HANDLE<span class="token punctuation">)</span><span class="token number">2</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            m_dwThreadID <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
            g_hThreadHandle <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">return</span> g_hThreadHandle <span class="token operator">&gt;</span><span class="token punctuation">(</span>HANDLE<span class="token punctuation">)</span><span class="token number">1</span><span class="token punctuation">;</span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">else</span></span>
        pthread_t pt<span class="token punctuation">;</span>
        <span class="token function">pthread_create</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>pt<span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">,</span> event_run<span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">endif</span></span>
    <span class="token punctuation">}</span>

    <span class="token keyword">return</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x5148;&#x770B;getOperationManager()-&gt;startup();&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">IMCoreErrorCode <span class="token class-name">OperationManager</span><span class="token operator">::</span><span class="token function">startup</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    m_operationThread <span class="token operator">=</span> std<span class="token operator">::</span><span class="token function">thread</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token operator">&amp;</span><span class="token punctuation">]</span>
    <span class="token punctuation">{</span>
        std<span class="token operator">::</span>unique_lock <span class="token operator">&lt;</span>std<span class="token operator">::</span>mutex<span class="token operator">&gt;</span> <span class="token function">lck</span><span class="token punctuation">(</span>m_cvMutex<span class="token punctuation">)</span><span class="token punctuation">;</span>
        Operation<span class="token operator">*</span> pOperation <span class="token operator">=</span> <span class="token keyword">nullptr</span><span class="token punctuation">;</span>
        <span class="token keyword">while</span> <span class="token punctuation">(</span>m_bContinue<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>m_bContinue<span class="token punctuation">)</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>m_vecRealtimeOperations<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
                m_CV<span class="token punctuation">.</span><span class="token function">wait</span><span class="token punctuation">(</span>lck<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>m_bContinue<span class="token punctuation">)</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token punctuation">{</span>
                std<span class="token operator">::</span>lock_guard<span class="token operator">&lt;</span>std<span class="token operator">::</span>mutex<span class="token operator">&gt;</span> <span class="token function">lock</span><span class="token punctuation">(</span>m_mutexOperation<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span>m_vecRealtimeOperations<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
                    <span class="token keyword">continue</span><span class="token punctuation">;</span>
                pOperation <span class="token operator">=</span> m_vecRealtimeOperations<span class="token punctuation">.</span><span class="token function">front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                m_vecRealtimeOperations<span class="token punctuation">.</span><span class="token function">pop_front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>

            <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>m_bContinue<span class="token punctuation">)</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>

            <span class="token keyword">if</span> <span class="token punctuation">(</span>pOperation<span class="token punctuation">)</span>
            <span class="token punctuation">{</span>
                pOperation<span class="token operator">-&gt;</span><span class="token function">process</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                pOperation<span class="token operator">-&gt;</span><span class="token function">release</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">return</span> IMCORE_OK<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x8FD9;&#x91CC;&#x5229;&#x7528;&#x4E00;&#x4E2A;C++11&#x7684;&#x65B0;&#x8BED;&#x6CD5;lamda&#x8868;&#x8FBE;&#x5F0F;&#x6765;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x7EBF;&#x7A0B;&#xFF0C;&#x7EBF;&#x7A0B;&#x51FD;&#x6570;&#x5C31;&#x662F;lamda&#x8868;&#x8FBE;&#x5F0F;&#x7684;&#x5177;&#x4F53;&#x5185;&#x5BB9;&#xFF1A;&#x5148;&#x4ECE;&#x961F;&#x5217;&#x4E2D;&#x53D6;&#x51FA;&#x4EFB;&#x52A1;&#xFF0C;&#x7136;&#x540E;&#x6267;&#x884C;&#x3002;&#x6240;&#x6709;&#x7684;&#x4EFB;&#x52A1;&#x90FD;&#x7EE7;&#x627F;&#x5176;&#x57FA;&#x7C7B;Operation&#xFF0C;&#x800C;Operation&#x53C8;&#x7EE7;&#x627F;&#x63A5;&#x53E3;&#x7C7B;IOperatio&#xFF0C;&#x4EFB;&#x52A1;&#x7C7B;&#x6839;&#x636E;&#x81EA;&#x5DF1;&#x5177;&#x4F53;&#x9700;&#x8981;&#x505A;&#x4EC0;&#x4E48;&#x6765;&#x6539;&#x5199;process()&#x65B9;&#x6CD5;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">class</span> <span class="token class-name">NETWORK_DLL</span> Operation <span class="token operator">:</span> <span class="token keyword">public</span> IOperation
<span class="token punctuation">{</span>
    <span class="token keyword">enum</span> <span class="token class-name">OperationState</span>
    <span class="token punctuation">{</span>
        OPERATION_IDLE <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span>
        OPERATION_STARTING<span class="token punctuation">,</span>
        OPERATION_RUNNING<span class="token punctuation">,</span>
        OPERATION_CANCELLING<span class="token punctuation">,</span>
        OPERATION_FINISHED
    <span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">public</span><span class="token operator">:</span>
    <span class="token comment">/** @name Constructors and Destructor*/</span>

    <span class="token comment">//@{</span>
    <span class="token comment">/**
     * Constructor 
     */</span>
    <span class="token function">Operation</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">Operation</span><span class="token punctuation">(</span><span class="token keyword">const</span> std<span class="token operator">::</span>string<span class="token operator">&amp;</span> name<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">/**
     * Destructor
     */</span>
    <span class="token keyword">virtual</span> <span class="token operator">~</span><span class="token function">Operation</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//@}</span>

<span class="token keyword">public</span><span class="token operator">:</span>
    <span class="token keyword">virtual</span> <span class="token keyword">void</span> <span class="token function">processOpertion</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>

<span class="token keyword">public</span><span class="token operator">:</span>
    <span class="token keyword">virtual</span> <span class="token keyword">void</span> <span class="token function">process</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">virtual</span> <span class="token keyword">void</span> <span class="token function">release</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">inline</span> std<span class="token operator">::</span>string <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">const</span> <span class="token punctuation">{</span> <span class="token keyword">return</span> m_name<span class="token punctuation">;</span> <span class="token punctuation">}</span>
    <span class="token keyword">inline</span> <span class="token keyword">void</span> <span class="token function">set_name</span><span class="token punctuation">(</span>__in std<span class="token operator">::</span>string name<span class="token punctuation">)</span><span class="token punctuation">{</span> m_name <span class="token operator">=</span> name<span class="token punctuation">;</span> <span class="token punctuation">}</span>

<span class="token keyword">private</span><span class="token operator">:</span>
    OperationState            m_state<span class="token punctuation">;</span>
    std<span class="token operator">::</span>string                m_name<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">struct</span> <span class="token class-name">NETWORK_DLL</span> IOperation
<span class="token punctuation">{</span>
<span class="token keyword">public</span><span class="token operator">:</span>
    <span class="token keyword">virtual</span> <span class="token keyword">void</span> <span class="token function">process</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token comment">//private:</span>
    <span class="token comment">/**
    * &#x5FC5;&#x987B;&#x8BA9;&#x5BB9;&#x5668;&#x6765;&#x91CA;&#x653E;&#x81EA;&#x5DF1;
    *
    * @return  void
    * @exception there is no any exception to throw.
    */</span>
    <span class="token keyword">virtual</span> <span class="token keyword">void</span> <span class="token function">release</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x4ECB;&#x7ECD;&#x7684;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x6211;&#x4EEC;&#x79F0;&#x4E3A;&#x961F;&#x5217;A&#xFF0C;&#x4E0B;&#x6587;&#x4E2D;&#x8FD8;&#x6709;&#x4E00;&#x4E2A;&#x4E13;&#x95E8;&#x505A;http&#x8BF7;&#x6C42;&#x7684;&#x961F;&#x5217;&#xFF0C;&#x6211;&#x4EEC;&#x79F0;&#x4E3A;&#x961F;&#x5217;B&#x3002;</p>
<p>&#x540E;&#x534A;&#x90E8;&#x5206;&#x4EE3;&#x7801;&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x542F;&#x52A8;&#x7F51;&#x7EDC;&#x68C0;&#x6D4B;&#x7EBF;&#x7A0B;&#xFF0C;&#x68C0;&#x6D4B;&#x7F51;&#x7EDC;&#x6570;&#x636E;&#x8BFB;&#x5199;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">g_hThreadHandle <span class="token operator">=</span> <span class="token punctuation">(</span>HANDLE<span class="token punctuation">)</span><span class="token function">_beginthreadex</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> event_run<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token keyword">unsigned</span><span class="token operator">*</span><span class="token punctuation">)</span><span class="token operator">&amp;</span>m_dwThreadID<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">unsigned</span> <span class="token keyword">int</span> __stdcall <span class="token function">event_run</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token operator">*</span> threadArgu<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span>  <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;event_run&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">netlib_init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">netlib_set_running</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">netlib_eventloop</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> <span class="token constant">NULL</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token function">netlib_eventloop</span><span class="token punctuation">(</span><span class="token keyword">uint32_t</span> wait_timeout<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token class-name">CEventDispatch</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">StartDispatch</span><span class="token punctuation">(</span>wait_timeout<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">CEventDispatch</span><span class="token operator">::</span><span class="token function">StartDispatch</span><span class="token punctuation">(</span><span class="token keyword">uint32_t</span> wait_timeout<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    fd_set read_set<span class="token punctuation">,</span> write_set<span class="token punctuation">,</span> excep_set<span class="token punctuation">;</span>
    timeval timeout<span class="token punctuation">;</span>
    timeout<span class="token punctuation">.</span>tv_sec <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span>    <span class="token comment">//wait_timeout 1 second</span>
    timeout<span class="token punctuation">.</span>tv_usec <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>

    <span class="token keyword">while</span> <span class="token punctuation">(</span>running<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token comment">//_CheckTimer();</span>
        <span class="token comment">//_CheckLoop();</span>

        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>m_read_set<span class="token punctuation">.</span>fd_count <span class="token operator">&amp;&amp;</span> <span class="token operator">!</span>m_write_set<span class="token punctuation">.</span>fd_count <span class="token operator">&amp;&amp;</span> <span class="token operator">!</span>m_excep_set<span class="token punctuation">.</span>fd_count<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token function">Sleep</span><span class="token punctuation">(</span>MIN_TIMER_DURATION<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">continue</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>

        m_lock<span class="token punctuation">.</span><span class="token function">lock</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">FD_ZERO</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>read_set<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">FD_ZERO</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>write_set<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">FD_ZERO</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>excep_set<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">memcpy</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>read_set<span class="token punctuation">,</span> <span class="token operator">&amp;</span>m_read_set<span class="token punctuation">,</span> <span class="token keyword">sizeof</span><span class="token punctuation">(</span>fd_set<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">memcpy</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>write_set<span class="token punctuation">,</span> <span class="token operator">&amp;</span>m_write_set<span class="token punctuation">,</span> <span class="token keyword">sizeof</span><span class="token punctuation">(</span>fd_set<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">memcpy</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>excep_set<span class="token punctuation">,</span> <span class="token operator">&amp;</span>m_excep_set<span class="token punctuation">,</span> <span class="token keyword">sizeof</span><span class="token punctuation">(</span>fd_set<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        m_lock<span class="token punctuation">.</span><span class="token function">unlock</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>running<span class="token punctuation">)</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>

        <span class="token comment">//for (int i = 0; i &lt; read_set.fd_count; i++) {</span>
        <span class="token comment">//    LOG__(NET,  &quot;read fd: %d\n&quot;, read_set.fd_array[i]);</span>
        <span class="token comment">//}</span>
        <span class="token keyword">int</span> nfds <span class="token operator">=</span> <span class="token function">select</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token operator">&amp;</span>read_set<span class="token punctuation">,</span> <span class="token operator">&amp;</span>write_set<span class="token punctuation">,</span> <span class="token operator">&amp;</span>excep_set<span class="token punctuation">,</span> <span class="token operator">&amp;</span>timeout<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>nfds <span class="token operator">==</span> SOCKET_ERROR<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token comment">//LOG__(NET,  &quot;select failed, error code: %d\n&quot;, GetLastError());</span>
            <span class="token function">Sleep</span><span class="token punctuation">(</span>MIN_TIMER_DURATION<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">continue</span><span class="token punctuation">;</span>            <span class="token comment">// select again</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>nfds <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token keyword">continue</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">for</span> <span class="token punctuation">(</span>u_int i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> read_set<span class="token punctuation">.</span>fd_count<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token comment">//LOG__(NET,  &quot;select return read count=%d\n&quot;, read_set.fd_count);</span>
            SOCKET fd <span class="token operator">=</span> read_set<span class="token punctuation">.</span>fd_array<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
            CBaseSocket<span class="token operator">*</span> pSocket <span class="token operator">=</span> <span class="token function">FindBaseSocket</span><span class="token punctuation">(</span><span class="token punctuation">(</span>net_handle_t<span class="token punctuation">)</span>fd<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>pSocket<span class="token punctuation">)</span>
            <span class="token punctuation">{</span>
                pSocket<span class="token operator">-&gt;</span><span class="token function">OnRead</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                pSocket<span class="token operator">-&gt;</span><span class="token function">ReleaseRef</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">for</span> <span class="token punctuation">(</span>u_int i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> write_set<span class="token punctuation">.</span>fd_count<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token comment">//LOG__(NET,  &quot;select return write count=%d\n&quot;, write_set.fd_count);</span>
            SOCKET fd <span class="token operator">=</span> write_set<span class="token punctuation">.</span>fd_array<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
            CBaseSocket<span class="token operator">*</span> pSocket <span class="token operator">=</span> <span class="token function">FindBaseSocket</span><span class="token punctuation">(</span><span class="token punctuation">(</span>net_handle_t<span class="token punctuation">)</span>fd<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>pSocket<span class="token punctuation">)</span>
            <span class="token punctuation">{</span>
                pSocket<span class="token operator">-&gt;</span><span class="token function">OnWrite</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                pSocket<span class="token operator">-&gt;</span><span class="token function">ReleaseRef</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">for</span> <span class="token punctuation">(</span>u_int i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> excep_set<span class="token punctuation">.</span>fd_count<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span>  <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;select return exception count=%d&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> excep_set<span class="token punctuation">.</span>fd_count<span class="token punctuation">)</span><span class="token punctuation">;</span>
            SOCKET fd <span class="token operator">=</span> excep_set<span class="token punctuation">.</span>fd_array<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
            CBaseSocket<span class="token operator">*</span> pSocket <span class="token operator">=</span> <span class="token function">FindBaseSocket</span><span class="token punctuation">(</span><span class="token punctuation">(</span>net_handle_t<span class="token punctuation">)</span>fd<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>pSocket<span class="token punctuation">)</span>
            <span class="token punctuation">{</span>
                pSocket<span class="token operator">-&gt;</span><span class="token function">OnClose</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                pSocket<span class="token operator">-&gt;</span><span class="token function">ReleaseRef</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x6211;&#x4EEC;&#x4E3E;&#x4E2A;&#x5177;&#x4F53;&#x7684;&#x4F8B;&#x5B50;&#x6765;&#x8BF4;&#x660E;&#x8FD9;&#x4E2A;&#x4E09;&#x4E2A;&#x7EBF;&#x7A0B;&#x7684;&#x903B;&#x8F91;&#xFF08;&#x4EFB;&#x52A1;&#x961F;&#x5217;A&#x3001;&#x7F51;&#x7EDC;&#x7EBF;&#x7A0B;&#x548C;&#x4E0B;&#x6587;&#x8981;&#x4ECB;&#x7ECD;&#x7684;&#x4E13;&#x95E8;&#x5904;&#x7406;http&#x8BF7;&#x6C42;&#x7684;&#x4EFB;&#x52A1;&#x961F;&#x5217;B&#xFF09;&#x548C;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x7684;&#x6D88;&#x606F;&#x961F;&#x5217;&#xFF0C;&#x4EE5;&#x5728;&#x767B;&#x5F55;&#x5BF9;&#x8BDD;&#x6846;&#x8F93;&#x5165;&#x7528;&#x6237;&#x540D;&#x548C;&#x5BC6;&#x7801;&#x540E;&#x63A5;&#x4E0B;&#x6765;&#x7684;&#x6B65;&#x9AA4;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token comment">//&#x4F4D;&#x4E8E;LoginDialog.cpp&#x4E2D;</span>
<span class="token keyword">void</span> <span class="token class-name">LoginDialog</span><span class="token operator">::</span><span class="token function">_DoLogin</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;User Clicked LoginBtn&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    m_ptxtTip<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    CDuiString userName <span class="token operator">=</span> m_pedtUserName<span class="token operator">-&gt;</span><span class="token function">GetText</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    CDuiString password <span class="token operator">=</span> m_pedtPassword<span class="token operator">-&gt;</span><span class="token function">GetText</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>userName<span class="token punctuation">.</span><span class="token function">IsEmpty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        CString csTip <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_USERNAME_EMPTY&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        m_ptxtTip<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>csTip<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>password<span class="token punctuation">.</span><span class="token function">IsEmpty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        CString csTip <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_PASSWORD_EMPTY&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        m_ptxtTip<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>csTip<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    module<span class="token operator">::</span>TTConfig<span class="token operator">*</span> pCfg <span class="token operator">=</span> module<span class="token operator">::</span><span class="token function">getSysConfigModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getSystemConfig</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    pCfg<span class="token operator">-&gt;</span>userName <span class="token operator">=</span> userName<span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>m_bPassChanged<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        std<span class="token operator">::</span>string sPass <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">cStringToString</span><span class="token punctuation">(</span><span class="token function">CString</span><span class="token punctuation">(</span>password<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">char</span><span class="token operator">*</span> pOutData <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
        <span class="token keyword">uint32_t</span> nOutLen <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
        <span class="token keyword">int</span> retCode <span class="token operator">=</span> <span class="token function">EncryptPass</span><span class="token punctuation">(</span>sPass<span class="token punctuation">.</span><span class="token function">c_str</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> sPass<span class="token punctuation">.</span><span class="token function">length</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token operator">&amp;</span>pOutData<span class="token punctuation">,</span> nOutLen<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>retCode <span class="token operator">==</span> <span class="token number">0</span> <span class="token operator">&amp;&amp;</span> nOutLen <span class="token operator">&gt;</span> <span class="token number">0</span> <span class="token operator">&amp;&amp;</span> pOutData <span class="token operator">!=</span> <span class="token number">0</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            pCfg<span class="token operator">-&gt;</span>password <span class="token operator">=</span> std<span class="token operator">::</span><span class="token function">string</span><span class="token punctuation">(</span>pOutData<span class="token punctuation">,</span> nOutLen<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Free</span><span class="token punctuation">(</span>pOutData<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">else</span>
        <span class="token punctuation">{</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;EncryptPass Failed!&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            CString csTip <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_LOGIN_ENCRYPT_PASE_FAIL&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            m_ptxtTip<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>csTip<span class="token punctuation">)</span><span class="token punctuation">;</span>            
            <span class="token keyword">return</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

    pCfg<span class="token operator">-&gt;</span>isRememberPWD <span class="token operator">=</span> m_pChkRememberPWD<span class="token operator">-&gt;</span><span class="token function">GetCheck</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    module<span class="token operator">::</span><span class="token function">getSysConfigModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">saveData</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    CString csTxt <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_BTN_DOLOGIN&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    m_pBtnLogin<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>csTxt<span class="token punctuation">)</span><span class="token punctuation">;</span>
    m_pBtnLogin<span class="token operator">-&gt;</span><span class="token function">SetEnabled</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//&#x8FDE;&#x63A5;&#x767B;&#x9646;&#x670D;&#x52A1;&#x5668;</span>
    DoLoginServerParam param<span class="token punctuation">;</span>
    DoLoginServerHttpOperation<span class="token operator">*</span> pOper <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token function">DoLoginServerHttpOperation</span><span class="token punctuation">(</span>
        <span class="token function">BIND_CALLBACK_1</span><span class="token punctuation">(</span>LoginDialog<span class="token operator">::</span>OnHttpCallbackOperation<span class="token punctuation">)</span><span class="token punctuation">,</span> param<span class="token punctuation">)</span><span class="token punctuation">;</span>
    module<span class="token operator">::</span><span class="token function">getHttpPoolModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">pushHttpOperation</span><span class="token punctuation">(</span>pOper<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x70B9;&#x51FB;&#x767B;&#x5F55;&#x6309;&#x94AE;&#x4E4B;&#x540E;&#xFF0C;&#x7A0B;&#x5E8F;&#x5148;&#x5BF9;&#x7528;&#x6237;&#x540D;&#x548C;&#x5BC6;&#x7801;&#x8FDB;&#x884C;&#x4E00;&#x4E9B;&#x6709;&#x6548;&#x6027;&#x6821;&#x9A8C;&#xFF0C;&#x63A5;&#x7740;&#x4EA7;&#x751F;&#x4E00;&#x4E2A;DoLoginServerHttpOperation&#x5BF9;&#x8C61;&#xFF0C;&#x8BE5;&#x7C7B;&#x7EE7;&#x627F;IHttpOperation&#xFF0C;IHttpOperation&#x518D;&#x7EE7;&#x627F;ICallbackOpertaion&#xFF0C;ICallbackOpertaion&#x518D;&#x7EE7;&#x627F;Operation&#x7C7B;&#x3002;&#x8FD9;&#x4E2A;&#x4EFB;&#x52A1;&#x4F1A;&#x7ED1;&#x5B9A;&#x4E00;&#x4E2A;&#x4EFB;&#x52A1;&#x5B8C;&#x6210;&#x4E4B;&#x540E;&#x7684;&#x56DE;&#x8C03;&#x51FD;&#x6570;&#xFF0C;&#x5373;&#x5B8F;BIND_CALLBACK_1&#xFF0C;&#x8FD9;&#x4E2A;&#x5B8F;&#x5B9E;&#x9645;&#x4E0A;&#x5C31;&#x662F;std::bind&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span> <span class="token expression"><span class="token function">BIND_CALLBACK_1</span><span class="token punctuation">(</span>func<span class="token punctuation">)</span>   std<span class="token operator">::</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>func<span class="token punctuation">,</span> <span class="token keyword">this</span><span class="token punctuation">,</span> placeholders<span class="token operator">::</span>_1<span class="token punctuation">)</span></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span> <span class="token expression"><span class="token function">BIND_CALLBACK_2</span><span class="token punctuation">(</span>func<span class="token punctuation">)</span>    std<span class="token operator">::</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>func<span class="token punctuation">,</span> <span class="token keyword">this</span><span class="token punctuation">,</span> placeholders<span class="token operator">::</span>_1<span class="token punctuation">,</span> placeholders<span class="token operator">::</span>_2<span class="token punctuation">)</span></span></span>
</code></pre>
<p>&#x5F80;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x4E2D;&#x653E;&#x5165;&#x4EFB;&#x52A1;&#x7684;&#x52A8;&#x4F5C;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">HttpPoolModule_Impl</span><span class="token operator">::</span><span class="token function">pushHttpOperation</span><span class="token punctuation">(</span>module<span class="token operator">::</span>IHttpOperation<span class="token operator">*</span> pOperaion<span class="token punctuation">,</span> BOOL bHighPriority <span class="token comment">/*= FALSE*/</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token constant">NULL</span> <span class="token operator">==</span> pOperaion<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    CAutoLock <span class="token function">lock</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>m_mtxLock<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>bHighPriority<span class="token punctuation">)</span>
        m_lstHttpOpers<span class="token punctuation">.</span><span class="token function">push_front</span><span class="token punctuation">(</span>pOperaion<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">else</span>
        m_lstHttpOpers<span class="token punctuation">.</span><span class="token function">push_back</span><span class="token punctuation">(</span>pOperaion<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">_launchThread</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token operator">::</span><span class="token function">ReleaseSemaphore</span><span class="token punctuation">(</span>m_hSemaphore<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">return</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x5176;&#x4E2D;_launchThread()&#x4F1A;&#x542F;&#x52A8;&#x4E00;&#x4E2A;&#x7EBF;&#x7A0B;&#xFF0C;&#x8BE5;&#x7EBF;&#x7A0B;&#x51FD;&#x6570;&#x662F;&#x53E6;&#x5916;&#x4E00;&#x4E2A;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#xFF0C;&#x4E13;&#x95E8;&#x5904;&#x7406;http&#x4EFB;&#x52A1;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">BOOL <span class="token class-name">HttpPoolModule_Impl</span><span class="token operator">::</span><span class="token function">_launchThread</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">)</span>m_vecHttpThread<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">&gt;=</span> MAX_THEAD_COUNT<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">return</span> TRUE<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    TTHttpThread<span class="token operator">*</span> pThread <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token function">TTHttpThread</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">PTR_FALSE</span><span class="token punctuation">(</span>pThread<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>pThread<span class="token operator">-&gt;</span><span class="token function">create</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">return</span> FALSE<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token function">Sleep</span><span class="token punctuation">(</span><span class="token number">300</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    m_vecHttpThread<span class="token punctuation">.</span><span class="token function">push_back</span><span class="token punctuation">(</span>pThread<span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">return</span> TRUE<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x7EBF;&#x7A0B;&#x51FD;&#x6570;&#x6700;&#x7EC8;&#x5B9E;&#x9645;&#x6267;&#x884C;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">UInt32 <span class="token class-name">TTHttpThread</span><span class="token operator">::</span><span class="token function">process</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    module<span class="token operator">::</span>IHttpOperation <span class="token operator">*</span> pHttpOper <span class="token operator">=</span> <span class="token constant">NULL</span><span class="token punctuation">;</span>
    HttpPoolModule_Impl <span class="token operator">*</span>pPool <span class="token operator">=</span> m_pInstance<span class="token punctuation">;</span>
    <span class="token keyword">while</span> <span class="token punctuation">(</span>m_bContinue<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>WAIT_OBJECT_0 <span class="token operator">!=</span> <span class="token operator">::</span><span class="token function">WaitForSingleObject</span><span class="token punctuation">(</span>pPool<span class="token operator">-&gt;</span>m_hSemaphore<span class="token punctuation">,</span> INFINITE<span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>

        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>m_bContinue<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>

        <span class="token punctuation">{</span>
            CAutoLock <span class="token function">lock</span><span class="token punctuation">(</span><span class="token operator">&amp;</span><span class="token punctuation">(</span>pPool<span class="token operator">-&gt;</span>m_mtxLock<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>pPool<span class="token operator">-&gt;</span>m_lstHttpOpers<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
                pHttpOper <span class="token operator">=</span> <span class="token constant">NULL</span><span class="token punctuation">;</span>
            <span class="token keyword">else</span>
            <span class="token punctuation">{</span>
                pHttpOper <span class="token operator">=</span> pPool<span class="token operator">-&gt;</span>m_lstHttpOpers<span class="token punctuation">.</span><span class="token function">front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                pPool<span class="token operator">-&gt;</span>m_lstHttpOpers<span class="token punctuation">.</span><span class="token function">pop_front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>

        <span class="token keyword">try</span>
        <span class="token punctuation">{</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>m_bContinue <span class="token operator">&amp;&amp;</span> pHttpOper<span class="token punctuation">)</span>
            <span class="token punctuation">{</span>
                pHttpOper<span class="token operator">-&gt;</span><span class="token function">process</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                pHttpOper<span class="token operator">-&gt;</span><span class="token function">release</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">catch</span> <span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;TTHttpThread: Failed to execute opertaion(0x%p)&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> pHttpOper<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">return</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x5F53;&#x8FD9;&#x4E2A;http&#x4EFB;&#x52A1;&#x88AB;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x6267;&#x884C;&#x65F6;&#xFF0C;&#x5B9E;&#x9645;&#x6267;&#x884C;DoLoginServerHttpOperation::processOpertion()&#xFF0C;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">DoLoginServerHttpOperation</span><span class="token operator">::</span><span class="token function">processOpertion</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    module<span class="token operator">::</span>TTConfig<span class="token operator">*</span> pCfg <span class="token operator">=</span> module<span class="token operator">::</span><span class="token function">getSysConfigModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getSystemConfig</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;loginAddr = %s&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> pCfg<span class="token operator">-&gt;</span>loginServIP<span class="token punctuation">)</span><span class="token punctuation">;</span>
    std<span class="token operator">::</span>string<span class="token operator">&amp;</span> loginAddr <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">cStringToString</span><span class="token punctuation">(</span>pCfg<span class="token operator">-&gt;</span>loginServIP<span class="token punctuation">)</span><span class="token punctuation">;</span>
    std<span class="token operator">::</span>string url <span class="token operator">=</span> loginAddr<span class="token punctuation">;</span>

    DoLoginServerParam<span class="token operator">*</span> pPamram <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token function">DoLoginServerParam</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    pPamram<span class="token operator">-&gt;</span>resMsg <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_LOGIN_HTTP_DEFERROR&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    Http<span class="token operator">::</span>HttpResponse    response<span class="token punctuation">;</span>
    Http<span class="token operator">::</span>HttpClient    client<span class="token punctuation">;</span>
    <span class="token comment">//&#x5BF9;&#x4E8E;&#x767B;&#x5F55;&#xFF1A;url=http://192.168.226.128:8080/msg_server</span>
    Http<span class="token operator">::</span>HttpRequest    <span class="token function">request</span><span class="token punctuation">(</span><span class="token string">&quot;get&quot;</span><span class="token punctuation">,</span> url<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>client<span class="token punctuation">.</span><span class="token function">execute</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>request<span class="token punctuation">,</span> <span class="token operator">&amp;</span>response<span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        CString csTemp <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>url<span class="token punctuation">)</span><span class="token punctuation">;</span>
        pPamram<span class="token operator">-&gt;</span>result <span class="token operator">=</span> DOLOGIN_FAIL<span class="token punctuation">;</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;failed %s&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> csTemp<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">asyncCallback</span><span class="token punctuation">(</span>std<span class="token operator">::</span>shared_ptr<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">&gt;</span><span class="token punctuation">(</span>pPamram<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        client<span class="token punctuation">.</span><span class="token function">killSelf</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token comment">/**
        {
           &quot;backupIP&quot; : &quot;localhost&quot;,
           &quot;code&quot; : 0,
           &quot;discovery&quot; : &quot;http://127.0.0.1/api/discovery&quot;,
           &quot;msfsBackup&quot; : &quot;http://127.0.0.1:8700/&quot;,
           &quot;msfsPrior&quot; : &quot;http://127.0.0.1:8700/&quot;,
           &quot;msg&quot; : &quot;&quot;,
           &quot;port&quot; : &quot;8000&quot;,
           &quot;priorIP&quot; : &quot;localhost&quot;
        }
     */</span>
    std<span class="token operator">::</span>string body <span class="token operator">=</span> response<span class="token punctuation">.</span><span class="token function">getBody</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    client<span class="token punctuation">.</span><span class="token function">killSelf</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//json&#x89E3;&#x6790;</span>
    <span class="token keyword">try</span>
    <span class="token punctuation">{</span>
        Json<span class="token operator">::</span>Reader reader<span class="token punctuation">;</span>
        Json<span class="token operator">::</span>Value root<span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>reader<span class="token punctuation">.</span><span class="token function">parse</span><span class="token punctuation">(</span>body<span class="token punctuation">,</span> root<span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            CString csTemp <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>body<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;parse data failed,%s&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> csTemp<span class="token punctuation">)</span><span class="token punctuation">;</span>
            pPamram<span class="token operator">-&gt;</span>result <span class="token operator">=</span> DOLOGIN_FAIL<span class="token punctuation">;</span>
            pPamram<span class="token operator">-&gt;</span>resMsg <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_LOGIN_HTTP_JSONERROR&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">goto</span> End<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">int</span> nCode <span class="token operator">=</span> root<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;code&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">asInt</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token number">0</span> <span class="token operator">==</span> nCode<span class="token punctuation">)</span><span class="token comment">//&#x767B;&#x9646;&#x6210;&#x529F;</span>
        <span class="token punctuation">{</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;get msgSvr IP succeed!&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            pCfg<span class="token operator">-&gt;</span>msgSevPriorIP <span class="token operator">=</span> root<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;priorIP&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">asString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            pCfg<span class="token operator">-&gt;</span>msgSevBackupIP <span class="token operator">=</span> root<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;backupIP&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">asString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            std<span class="token operator">::</span>string strPort <span class="token operator">=</span> root<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;port&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">asString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            pCfg<span class="token operator">-&gt;</span>msgServPort <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToInt32</span><span class="token punctuation">(</span>strPort<span class="token punctuation">)</span><span class="token punctuation">;</span>

            pCfg<span class="token operator">-&gt;</span>fileSysAddr <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>root<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;msfsPrior&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">asString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            pCfg<span class="token operator">-&gt;</span>fileSysBackUpAddr <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>root<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;msfsBackup&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">asString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            pPamram<span class="token operator">-&gt;</span>result <span class="token operator">=</span> DOLOGIN_SUCC<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">else</span>
        <span class="token punctuation">{</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;get msgSvr IP failed! Code = %d&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>nCode<span class="token punctuation">)</span><span class="token punctuation">;</span>
            pPamram<span class="token operator">-&gt;</span>result <span class="token operator">=</span> DOLOGIN_FAIL<span class="token punctuation">;</span>
            CString csRetMsgTemp <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>root<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;msg&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">asString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>csRetMsgTemp<span class="token punctuation">.</span><span class="token function">IsEmpty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
                pPamram<span class="token operator">-&gt;</span>resMsg <span class="token operator">=</span> csRetMsgTemp<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">catch</span> <span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        CString csTemp <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>body<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;parse json execption,%s&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> csTemp<span class="token punctuation">)</span><span class="token punctuation">;</span>
        pPamram<span class="token operator">-&gt;</span>result <span class="token operator">=</span> DOLOGIN_FAIL<span class="token punctuation">;</span>
        pPamram<span class="token operator">-&gt;</span>resMsg <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_LOGIN_HTTP_JSONERROR&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

End<span class="token operator">:</span>
    <span class="token function">asyncCallback</span><span class="token punctuation">(</span>std<span class="token operator">::</span>shared_ptr<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">&gt;</span><span class="token punctuation">(</span>pPamram<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x5411;login_server&#x53D1;&#x9001;&#x4E00;&#x4E2A;http&#x8BF7;&#x6C42;&#xFF0C;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x540C;&#x6B65;&#x8BF7;&#x6C42;&#x3002;&#x5F97;&#x5230;&#x7684;&#x7ED3;&#x679C;&#x662F;&#x4E00;&#x4E2A;json&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x4EE3;&#x7801;&#x6CE8;&#x91CA;&#x4E2D;&#x5DF2;&#x7ECF;&#x7ED9;&#x51FA;&#x3002;&#x7136;&#x540E;&#x8C03;&#x7528;asyncCallback(std::shared_ptr<void>(pPamram));&#x53C2;&#x6570;pPamram&#x643A;&#x5E26;&#x4E86;&#x5F53;&#x524D;&#x4EFB;&#x52A1;&#x7684;&#x56DE;&#x8C03;&#x51FD;&#x6570;&#x6307;&#x9488;&#xFF1A;</void></p>
<pre class="language-"><code class="lang-cpp"><span class="token comment">/**
* &#x5F02;&#x6B65;&#x56DE;&#x8C03;&#xFF0C;&#x501F;&#x52A9;UIEvent
*
* @param   std::shared_ptr&lt;void&gt; param
* @return  void
* @exception there is no any exception to throw.
*/</span>

<span class="token keyword">void</span> <span class="token function">asyncCallback</span><span class="token punctuation">(</span>std<span class="token operator">::</span>shared_ptr<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">&gt;</span> param<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    CallbackOperationEvent<span class="token operator">*</span> pEvent <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token function">CallbackOperationEvent</span><span class="token punctuation">(</span>m_callback<span class="token punctuation">,</span> param<span class="token punctuation">)</span><span class="token punctuation">;</span>
    module<span class="token operator">::</span><span class="token function">getEventManager</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">asynFireUIEvent</span><span class="token punctuation">(</span>pEvent<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x8FD9;&#x5B9E;&#x9645;&#x4E0A;&#x4EA7;&#x751F;&#x4E86;&#x4E00;&#x4E2A;&#x56DE;&#x8C03;&#x4E8B;&#x4EF6;&#x3002;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#x961F;&#x5217;B&#x505A;http&#x8BF7;&#x6C42;&#xFF0C;&#x64CD;&#x4F5C;&#x5B8C;&#x6210;&#x540E;&#x5F80;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x7684;&#x6D88;&#x606F;&#x961F;&#x5217;&#x4E2D;&#x653E;&#x5165;&#x4E00;&#x4E2A;&#x56DE;&#x8C03;&#x4E8B;&#x4EF6;&#xFF0C;&#x8FD9;&#x4E2A;&#x4E8B;&#x4EF6;&#x901A;&#x8FC7;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x8FC7;&#x7A0B;&#x51FD;&#x6570;&#x6765;&#x5904;&#x7406;&#x7684;&#xFF08;&#x8FD9;&#x5C31;&#x662F;&#x4E0A;&#x6587;&#x4E2D;&#x7B2C;4&#x70B9;&#x4ECB;&#x7ECD;&#x7684;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x8FC7;&#x7A0B;&#x7684;&#x4F5C;&#x7528;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x5229;&#x7528;windows&#x6D88;&#x606F;&#x961F;&#x5217;&#x6765;&#x505A;&#x4EFB;&#x52A1;&#x5904;&#x7406;&#xFF08;&#x7CFB;&#x7EDF;&#x6709;&#x73B0;&#x6210;&#x7684;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x7CFB;&#x7EDF;&#xFF0C;&#x4E3A;&#x4F55;&#x4E0D;&#x5229;&#x7528;&#x5462;&#xFF1F;&#xFF09;&#xFF09;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">module<span class="token operator">::</span>IMCoreErrorCode <span class="token class-name">UIEventManager</span><span class="token operator">::</span><span class="token function">asynFireUIEvent</span><span class="token punctuation">(</span>IN <span class="token keyword">const</span> IEvent<span class="token operator">*</span> <span class="token keyword">const</span> pEvent<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token function">assert</span><span class="token punctuation">(</span>m_hWnd<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">assert</span><span class="token punctuation">(</span>pEvent<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token number">0</span> <span class="token operator">==</span> m_hWnd <span class="token operator">||</span> <span class="token number">0</span> <span class="token operator">==</span> pEvent<span class="token punctuation">)</span>
        <span class="token keyword">return</span> IMCORE_ARGUMENT_ERROR<span class="token punctuation">;</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span>FALSE <span class="token operator">==</span> <span class="token operator">::</span><span class="token function">PostMessage</span><span class="token punctuation">(</span>m_hWnd<span class="token punctuation">,</span> UI_EVENT_MSG<span class="token punctuation">,</span> <span class="token keyword">reinterpret_cast</span><span class="token operator">&lt;</span>WPARAM<span class="token operator">&gt;</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">reinterpret_cast</span><span class="token operator">&lt;</span>WPARAM<span class="token operator">&gt;</span><span class="token punctuation">(</span>pEvent<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token keyword">return</span> IMCORE_WORK_POSTMESSAGE_ERROR<span class="token punctuation">;</span>

    <span class="token keyword">return</span> IMCORE_OK<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x770B;&#x5230;&#x6CA1;&#x6709;&#xFF1F;&#x5411;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x7684;&#x6D88;&#x606F;&#x961F;&#x5217;&#x4E2D;&#x6295;&#x9012;&#x4E00;&#x4E2A;UI_EVENT_MSG&#x4E8B;&#x4EF6;&#xFF0C;&#x5E76;&#x5728;&#x6D88;&#x606F;&#x53C2;&#x6570;LPARAM&#x4E2D;&#x4F20;&#x9012;&#x4E86;&#x56DE;&#x8C03;&#x4E8B;&#x4EF6;&#x7684;&#x5BF9;&#x8C61;&#x6307;&#x9488;&#x3002;&#x8FD9;&#x6837;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x8FC7;&#x7A0B;&#x51FD;&#x6570;&#x5C31;&#x53EF;&#x4EE5;&#x5904;&#x7406;&#x8FD9;&#x4E2A;&#x6D88;&#x606F;&#x4E86;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">LRESULT _stdcall <span class="token class-name">UIEventManager</span><span class="token operator">::</span><span class="token function">_WindowProc</span><span class="token punctuation">(</span>HWND hWnd
                                            <span class="token punctuation">,</span> UINT message
                                            <span class="token punctuation">,</span> WPARAM wparam
                                            <span class="token punctuation">,</span> LPARAM lparam<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">switch</span> <span class="token punctuation">(</span>message<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
    <span class="token keyword">case</span> UI_EVENT_MSG<span class="token operator">:</span>
        <span class="token keyword">reinterpret_cast</span><span class="token operator">&lt;</span>UIEventManager<span class="token operator">*</span><span class="token operator">&gt;</span><span class="token punctuation">(</span>wparam<span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">_processEvent</span><span class="token punctuation">(</span><span class="token keyword">reinterpret_cast</span><span class="token operator">&lt;</span>IEvent<span class="token operator">*</span><span class="token operator">&gt;</span><span class="token punctuation">(</span>lparam<span class="token punctuation">)</span><span class="token punctuation">,</span> TRUE<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> WM_TIMER<span class="token operator">:</span>
        <span class="token keyword">reinterpret_cast</span><span class="token operator">&lt;</span>UIEventManager<span class="token operator">*</span><span class="token operator">&gt;</span><span class="token punctuation">(</span>wparam<span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">_processTimer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">default</span><span class="token operator">:</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">return</span> <span class="token operator">::</span><span class="token function">DefWindowProc</span><span class="token punctuation">(</span>hWnd<span class="token punctuation">,</span> message<span class="token punctuation">,</span> wparam<span class="token punctuation">,</span> lparam<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">UIEventManager</span><span class="token operator">::</span><span class="token function">_processEvent</span><span class="token punctuation">(</span>IEvent<span class="token operator">*</span> pEvent<span class="token punctuation">,</span> BOOL bRelease<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token function">assert</span><span class="token punctuation">(</span>pEvent<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token number">0</span> <span class="token operator">==</span> pEvent<span class="token punctuation">)</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>

    <span class="token keyword">try</span>
    <span class="token punctuation">{</span>
        pEvent<span class="token operator">-&gt;</span><span class="token function">process</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>bRelease<span class="token punctuation">)</span>
            pEvent<span class="token operator">-&gt;</span><span class="token function">release</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">catch</span> <span class="token punctuation">(</span>imcore<span class="token operator">::</span>Exception <span class="token operator">*</span>e<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;event run exception&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        pEvent<span class="token operator">-&gt;</span><span class="token function">onException</span><span class="token punctuation">(</span>e<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>bRelease<span class="token punctuation">)</span>
            pEvent<span class="token operator">-&gt;</span><span class="token function">release</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>e<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;event run exception:%s&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>e<span class="token operator">-&gt;</span>m_msg<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">assert</span><span class="token punctuation">(</span>FALSE<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">catch</span> <span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;operation run exception,unknown reason&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>bRelease<span class="token punctuation">)</span>
            pEvent<span class="token operator">-&gt;</span><span class="token function">release</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">assert</span><span class="token punctuation">(</span>FALSE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x6839;&#x636E;C++&#x7684;&#x591A;&#x6001;&#x7279;&#x6027;&#xFF0C;pEvent-&gt;process()&#x5B9E;&#x9645;&#x4E0A;&#x8C03;&#x7528;&#x7684;&#x662F;CallbackOperationEvent.process()&#x3002;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">    <span class="token keyword">virtual</span> <span class="token keyword">void</span> <span class="token function">process</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">m_callback</span><span class="token punctuation">(</span>m_param<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
</code></pre>
<p>m_callback(m_param);&#x8C03;&#x7528;&#x7684;&#x5C31;&#x662F;&#x4E0A;&#x6587;&#x4E2D;&#x4ECB;&#x7ECD;DoLoginServerHttpOperation&#x64CD;&#x4F5C;&#x7684;&#x56DE;&#x8C03;&#x51FD;&#x6570;LoginDialog::OnHttpCallbackOperation()&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">LoginDialog</span><span class="token operator">::</span><span class="token function">OnHttpCallbackOperation</span><span class="token punctuation">(</span>std<span class="token operator">::</span>shared_ptr<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">&gt;</span> param<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    DoLoginServerParam<span class="token operator">*</span> pParam <span class="token operator">=</span> <span class="token punctuation">(</span>DoLoginServerParam<span class="token operator">*</span><span class="token punctuation">)</span>param<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>DOLOGIN_SUCC <span class="token operator">==</span> pParam<span class="token operator">-&gt;</span>result<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        module<span class="token operator">::</span>TTConfig<span class="token operator">*</span> pCfg <span class="token operator">=</span> module<span class="token operator">::</span><span class="token function">getSysConfigModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getSystemConfig</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">PTR_VOID</span><span class="token punctuation">(</span>pCfg<span class="token punctuation">)</span><span class="token punctuation">;</span>
        LoginParam loginparam<span class="token punctuation">;</span>
        loginparam<span class="token punctuation">.</span>csUserName <span class="token operator">=</span> pCfg<span class="token operator">-&gt;</span>userName<span class="token punctuation">;</span>
        loginparam<span class="token punctuation">.</span>password <span class="token operator">=</span> pCfg<span class="token operator">-&gt;</span>password<span class="token punctuation">;</span>
        loginparam<span class="token punctuation">.</span>csUserName<span class="token punctuation">.</span><span class="token function">Trim</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        LoginOperation<span class="token operator">*</span> pOperation <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token function">LoginOperation</span><span class="token punctuation">(</span>
            <span class="token function">BIND_CALLBACK_1</span><span class="token punctuation">(</span>LoginDialog<span class="token operator">::</span>OnOperationCallback<span class="token punctuation">)</span><span class="token punctuation">,</span> loginparam<span class="token punctuation">)</span><span class="token punctuation">;</span>
        imcore<span class="token operator">::</span><span class="token function">IMLibCoreStartOperation</span><span class="token punctuation">(</span>pOperation<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span>
    <span class="token punctuation">{</span>
        m_ptxtTip<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>pParam<span class="token operator">-&gt;</span>resMsg<span class="token punctuation">)</span><span class="token punctuation">;</span>
        module<span class="token operator">::</span>TTConfig<span class="token operator">*</span> pCfg <span class="token operator">=</span> module<span class="token operator">::</span><span class="token function">getSysConfigModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getSystemConfig</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;get MsgServer config faild,login server addres:%s:%d&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> pCfg<span class="token operator">-&gt;</span>loginServIP<span class="token punctuation">,</span>pCfg<span class="token operator">-&gt;</span>loginServPort<span class="token punctuation">)</span><span class="token punctuation">;</span>

        CString csTxt <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_BTN_LOGIN&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        m_pBtnLogin<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>csTxt<span class="token punctuation">)</span><span class="token punctuation">;</span>
        m_pBtnLogin<span class="token operator">-&gt;</span><span class="token function">SetEnabled</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>ok&#xFF0C;&#x7EC8;&#x4E8E;&#x5230;&#x5BB6;&#x4E86;&#x3002;&#x4F46;&#x662F;&#x8FD9;&#x5E76;&#x6CA1;&#x7ED3;&#x675F;&#xFF0C;&#x6211;&#x4EEC;&#x53EA;&#x4ECB;&#x7ECD;&#x4E86;&#x961F;&#x5217;B&#x548C;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x6D88;&#x606F;&#x961F;&#x5217;&#xFF0C;&#x8FD8;&#x6709;&#x961F;&#x5217;A&#x5462;&#xFF1F;LoginDialog::OnHttpCallbackOperation()&#x4F1A;&#x6839;&#x636E;&#x83B7;&#x53D6;&#x7684;msg_server&#x7684;&#x60C5;&#x51B5;&#x6765;&#x518D;&#x6B21;&#x4EA7;&#x751F;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x4EFB;&#x52A1;LoginOperation&#x6765;&#x653E;&#x5165;&#x961F;&#x5217;A&#x4E2D;&#xFF0C;&#x8FD9;&#x6B21;&#x624D;&#x662F;&#x771F;&#x6B63;&#x7684;&#x7528;&#x6237;&#x767B;&#x5F55;&#xFF0C;&#x6839;&#x636E;&#x4E0A;&#x9762;&#x7684;&#x4ECB;&#x7ECD;&#xFF0C;LoginOperation&#x4EFB;&#x52A1;&#x4ECE;&#x961F;&#x5217;A&#x4E2D;&#x53D6;&#x51FA;&#x6765;&#x4E4B;&#x540E;&#xFF0C;&#x5B9E;&#x9645;&#x6267;&#x884C;&#x7684;&#x662F;LoginOperation::processOpertion()&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">LoginOperation</span><span class="token operator">::</span><span class="token function">processOpertion</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;login start,uname:%s,status:%d&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> m_loginParam<span class="token punctuation">.</span>csUserName
        <span class="token punctuation">,</span> m_loginParam<span class="token punctuation">.</span>mySelectedStatus<span class="token punctuation">)</span><span class="token punctuation">;</span>

    LoginParam<span class="token operator">*</span> pParam <span class="token operator">=</span> <span class="token keyword">new</span> LoginParam<span class="token punctuation">;</span>
    pParam<span class="token operator">-&gt;</span>csUserName <span class="token operator">=</span> m_loginParam<span class="token punctuation">.</span>csUserName<span class="token punctuation">;</span>
    pParam<span class="token operator">-&gt;</span>mySelectedStatus <span class="token operator">=</span> m_loginParam<span class="token punctuation">.</span>mySelectedStatus<span class="token punctuation">;</span>

    <span class="token comment">//&#x8FDE;&#x63A5;&#x6D88;&#x606F;&#x670D;&#x52A1;&#x5668;</span>
    module<span class="token operator">::</span>TTConfig<span class="token operator">*</span> pCfg <span class="token operator">=</span> module<span class="token operator">::</span><span class="token function">getSysConfigModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getSystemConfig</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    CString server <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>pCfg<span class="token operator">-&gt;</span>msgSevPriorIP<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;MsgServeIp:%s,Port:%d&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> server<span class="token punctuation">,</span> pCfg<span class="token operator">-&gt;</span>msgServPort<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//8000&#x7AEF;&#x53E3;</span>
    IM<span class="token operator">::</span>Login<span class="token operator">::</span>IMLoginRes<span class="token operator">*</span> pImLoginResp <span class="token operator">=</span> <span class="token punctuation">(</span>IM<span class="token operator">::</span>Login<span class="token operator">::</span>IMLoginRes<span class="token operator">*</span><span class="token punctuation">)</span>module<span class="token operator">::</span><span class="token function">getTcpClientModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
        <span class="token operator">-&gt;</span><span class="token function">doLogin</span><span class="token punctuation">(</span>server<span class="token punctuation">,</span> pCfg<span class="token operator">-&gt;</span>msgServPort<span class="token punctuation">,</span>m_loginParam<span class="token punctuation">.</span>csUserName<span class="token punctuation">,</span>m_loginParam<span class="token punctuation">.</span>password<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token number">0</span> <span class="token operator">==</span> pImLoginResp <span class="token operator">||</span> pImLoginResp<span class="token operator">-&gt;</span><span class="token function">result_code</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">!=</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>REFUSE_REASON_NONE 
        <span class="token operator">||</span> <span class="token operator">!</span>pImLoginResp<span class="token operator">-&gt;</span><span class="token function">has_user_info</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token comment">//TODO,&#x82E5;&#x5931;&#x8D25;&#xFF0C;&#x5C1D;&#x8BD5;&#x5907;&#x7528;IP</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;add:%s:%d,uname:%s,login for msg server failed&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>server<span class="token punctuation">,</span>pCfg<span class="token operator">-&gt;</span>msgServPort<span class="token punctuation">,</span> m_loginParam<span class="token punctuation">.</span>csUserName<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>pImLoginResp<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            CString errInfo <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>pImLoginResp<span class="token operator">-&gt;</span><span class="token function">result_string</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            pParam<span class="token operator">-&gt;</span>errInfo <span class="token operator">=</span> errInfo<span class="token punctuation">;</span>
            pParam<span class="token operator">-&gt;</span>result <span class="token operator">=</span> LOGIN_FAIL<span class="token punctuation">;</span>
            pParam<span class="token operator">-&gt;</span>server_result <span class="token operator">=</span> pImLoginResp<span class="token operator">-&gt;</span><span class="token function">result_code</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;error code :%d,error info:%s&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> pImLoginResp<span class="token operator">-&gt;</span><span class="token function">result_code</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> errInfo<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">else</span>
        <span class="token punctuation">{</span>
            pParam<span class="token operator">-&gt;</span>result <span class="token operator">=</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>REFUSE_REASON_NO_MSG_SERVER<span class="token punctuation">;</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;login msg server faild&#xFF01;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token function">asyncCallback</span><span class="token punctuation">(</span>std<span class="token operator">::</span>shared_ptr<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">&gt;</span><span class="token punctuation">(</span>pParam<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    pParam<span class="token operator">-&gt;</span>result <span class="token operator">=</span> LOGIN_OK<span class="token punctuation">;</span>
    pParam<span class="token operator">-&gt;</span>serverTime <span class="token operator">=</span> pImLoginResp<span class="token operator">-&gt;</span><span class="token function">server_time</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    pParam<span class="token operator">-&gt;</span>mySelectedStatus <span class="token operator">=</span> pImLoginResp<span class="token operator">-&gt;</span><span class="token function">online_status</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//&#x5B58;&#x50A8;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x8FD4;&#x56DE;&#x7684;userId</span>
    IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>UserInfo userInfo <span class="token operator">=</span> pImLoginResp<span class="token operator">-&gt;</span><span class="token function">user_info</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    pCfg<span class="token operator">-&gt;</span>userId <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">uint32ToString</span><span class="token punctuation">(</span>userInfo<span class="token punctuation">.</span><span class="token function">user_id</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    pCfg<span class="token operator">-&gt;</span>csUserId <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>pCfg<span class="token operator">-&gt;</span>userId<span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//&#x767B;&#x9646;&#x6210;&#x529F;&#xFF0C;&#x521B;&#x5EFA;&#x81EA;&#x5DF1;&#x7684;&#x4FE1;&#x606F;</span>
    module<span class="token operator">::</span>UserInfoEntity myInfo<span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>sId <span class="token operator">=</span> pCfg<span class="token operator">-&gt;</span>userId<span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>csName <span class="token operator">=</span> m_loginParam<span class="token punctuation">.</span>csUserName<span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>onlineState <span class="token operator">=</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>USER_STATUS_ONLINE<span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>csNickName <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>userInfo<span class="token punctuation">.</span><span class="token function">user_nick_name</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>avatarUrl <span class="token operator">=</span> userInfo<span class="token punctuation">.</span><span class="token function">avatar_url</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>dId <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">uint32ToString</span><span class="token punctuation">(</span>userInfo<span class="token punctuation">.</span><span class="token function">department_id</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>department <span class="token operator">=</span> myInfo<span class="token punctuation">.</span>dId<span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>email <span class="token operator">=</span> userInfo<span class="token punctuation">.</span><span class="token function">email</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>gender <span class="token operator">=</span> userInfo<span class="token punctuation">.</span><span class="token function">user_gender</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>user_domain <span class="token operator">=</span> userInfo<span class="token punctuation">.</span><span class="token function">user_domain</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>telephone <span class="token operator">=</span> userInfo<span class="token punctuation">.</span><span class="token function">user_tel</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>status <span class="token operator">=</span> userInfo<span class="token punctuation">.</span><span class="token function">status</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    myInfo<span class="token punctuation">.</span>signature <span class="token operator">=</span> userInfo<span class="token punctuation">.</span><span class="token function">sign_info</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    module<span class="token operator">::</span><span class="token function">getUserListModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">createUserInfo</span><span class="token punctuation">(</span>myInfo<span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token function">asyncCallback</span><span class="token punctuation">(</span>std<span class="token operator">::</span>shared_ptr<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">&gt;</span><span class="token punctuation">(</span>pParam<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token function">LOG__</span><span class="token punctuation">(</span>APP<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;login succeed! Name = %s Nickname = %s sId = %s status = %d&quot;</span><span class="token punctuation">)</span>
        <span class="token punctuation">,</span> m_loginParam<span class="token punctuation">.</span>csUserName
        <span class="token punctuation">,</span> util<span class="token operator">::</span><span class="token function">stringToCString</span><span class="token punctuation">(</span>userInfo<span class="token punctuation">.</span><span class="token function">user_nick_name</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">,</span> module<span class="token operator">::</span><span class="token function">getSysConfigModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">UserID</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
        <span class="token punctuation">,</span> m_loginParam<span class="token punctuation">.</span>mySelectedStatus<span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//&#x5F00;&#x59CB;&#x53D1;&#x9001;&#x5FC3;&#x8DF3;&#x5305;</span>
    module<span class="token operator">::</span><span class="token function">getTcpClientModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">startHeartbeat</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x540C;&#x7406;&#xFF0C;&#x6570;&#x636E;&#x5305;&#x53D1;&#x751F;&#x6210;&#x529F;&#x4EE5;&#x540E;&#xFF0C;&#x4F1A;&#x518D;&#x5F80;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x7684;&#x6D88;&#x606F;&#x961F;&#x5217;&#x4E2D;&#x4EA7;&#x751F;&#x4E00;&#x4E2A;&#x56DE;&#x8C03;&#x4E8B;&#x4EF6;&#xFF0C;&#x6700;&#x7EC8;&#x8C03;&#x7528;&#x521A;&#x624D;&#x8BF4;&#x7684;LoginOperation&#x7ED1;&#x5B9A;&#x7684;&#x56DE;&#x8C03;&#x51FD;&#x6570;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token function">asyncCallback</span><span class="token punctuation">(</span>std<span class="token operator">::</span>shared_ptr<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">&gt;</span> param<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    CallbackOperationEvent<span class="token operator">*</span> pEvent <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token function">CallbackOperationEvent</span><span class="token punctuation">(</span>m_callback<span class="token punctuation">,</span> param<span class="token punctuation">)</span><span class="token punctuation">;</span>
    module<span class="token operator">::</span><span class="token function">getEventManager</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">asynFireUIEvent</span><span class="token punctuation">(</span>pEvent<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">LoginDialog</span><span class="token operator">::</span><span class="token function">OnOperationCallback</span><span class="token punctuation">(</span>std<span class="token operator">::</span>shared_ptr<span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">&gt;</span> param<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    LoginParam<span class="token operator">*</span> pLoginParam <span class="token operator">=</span> <span class="token punctuation">(</span>LoginParam<span class="token operator">*</span><span class="token punctuation">)</span>param<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>


    <span class="token keyword">if</span> <span class="token punctuation">(</span>LOGIN_OK <span class="token operator">==</span> pLoginParam<span class="token operator">-&gt;</span>result<span class="token punctuation">)</span>    <span class="token comment">//&#x767B;&#x9646;&#x6210;&#x529F;</span>
    <span class="token punctuation">{</span>
        <span class="token function">Close</span><span class="token punctuation">(</span>IDOK<span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">//&#x521B;&#x5EFA;&#x7528;&#x6237;&#x76EE;&#x5F55;</span>
        <span class="token function">_CreateUsersFolder</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">//&#x5F00;&#x542F;&#x540C;&#x6B65;&#x6D88;&#x606F;&#x65F6;&#x95F4;timer</span>
        module<span class="token operator">::</span><span class="token function">getSessionModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">startSyncTimeTimer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        module<span class="token operator">::</span><span class="token function">getSessionModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">setTime</span><span class="token punctuation">(</span>pLoginParam<span class="token operator">-&gt;</span>serverTime<span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">//&#x901A;&#x77E5;&#x670D;&#x52A1;&#x5668;&#x5BA2;&#x6237;&#x7AEF;&#x521D;&#x59CB;&#x5316;&#x5B8C;&#x6BD5;,&#x83B7;&#x53D6;&#x7EC4;&#x7EC7;&#x67B6;&#x6784;&#x4FE1;&#x606F;&#x548C;&#x7FA4;&#x5217;&#x8868;</span>
        module<span class="token operator">::</span><span class="token function">getLoginModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">notifyLoginDone</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span>    <span class="token comment">//&#x767B;&#x9646;&#x5931;&#x8D25;&#x5904;&#x7406;</span>
    <span class="token punctuation">{</span>
        module<span class="token operator">::</span><span class="token function">getTcpClientModule</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">shutdown</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>REFUSE_REASON_NO_MSG_SERVER <span class="token operator">==</span> pLoginParam<span class="token operator">-&gt;</span>server_result<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            CString csTip <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_LOGIN_MSGSVR_FAIL&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            m_ptxtTip<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>csTip<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>pLoginParam<span class="token operator">-&gt;</span>errInfo<span class="token punctuation">.</span><span class="token function">IsEmpty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            m_ptxtTip<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>pLoginParam<span class="token operator">-&gt;</span>errInfo<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">else</span>
        <span class="token punctuation">{</span>
            CString errorCode <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">int32ToCString</span><span class="token punctuation">(</span>pLoginParam<span class="token operator">-&gt;</span>server_result<span class="token punctuation">)</span><span class="token punctuation">;</span>
            CString csTip <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_LOGIN_UNKNOWN_ERROR&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            m_ptxtTip<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>csTip <span class="token operator">+</span> <span class="token function">CString</span><span class="token punctuation">(</span><span class="token string">&quot;:&quot;</span><span class="token punctuation">)</span> <span class="token operator">+</span> errorCode<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

    CString csTxt <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">getMultilingual</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getStringById</span><span class="token punctuation">(</span><span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;STRID_LOGINDIALOG_BTN_LOGIN&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    m_pBtnLogin<span class="token operator">-&gt;</span><span class="token function">SetText</span><span class="token punctuation">(</span>csTxt<span class="token punctuation">)</span><span class="token punctuation">;</span>
    m_pBtnLogin<span class="token operator">-&gt;</span><span class="token function">SetEnabled</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x81F3;&#x6B64;&#xFF0C;&#x767B;&#x5F55;&#x624D;&#x6210;&#x529F;&#x3002;&#x7B49;&#x7B49;&#xFF0C;&#x90A3;&#x6570;&#x636E;&#x5305;&#x662F;&#x600E;&#x4E48;&#x53D1;&#x5230;&#x670D;&#x52A1;&#x5668;&#x7684;&#x5462;&#xFF1F;&#x8FD9;&#x4E5F;&#x662F;&#x4E00;&#x4E2A;&#x91CD;&#x70B9;&#xFF0C;&#x6211;&#x4EEC;&#x6765;&#x8BE6;&#x7EC6;&#x5730;&#x4ECB;&#x7ECD;&#x4E00;&#x4E0B;&#xFF0C;LoginOperation::processOpertion()&#x4E2D;&#x6709;&#x8FD9;&#x4E00;&#x884C;&#x4EE3;&#x7801;&#xFF1A;</p>
<p><img src="../imgs/tt27.png" alt=""></p>
<p>doLogin&#x51FD;&#x6570;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">IM<span class="token operator">::</span>Login<span class="token operator">::</span>IMLoginRes<span class="token operator">*</span> <span class="token class-name">TcpClientModule_Impl</span><span class="token operator">::</span><span class="token function">doLogin</span><span class="token punctuation">(</span>CString <span class="token operator">&amp;</span>linkaddr<span class="token punctuation">,</span> UInt16 port
    <span class="token punctuation">,</span>CString<span class="token operator">&amp;</span> uName<span class="token punctuation">,</span>std<span class="token operator">::</span>string<span class="token operator">&amp;</span> pass<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    m_socketHandle <span class="token operator">=</span> imcore<span class="token operator">::</span><span class="token function">IMLibCoreConnect</span><span class="token punctuation">(</span>util<span class="token operator">::</span><span class="token function">cStringToString</span><span class="token punctuation">(</span>linkaddr<span class="token punctuation">)</span><span class="token punctuation">,</span> port<span class="token punctuation">)</span><span class="token punctuation">;</span>
    imcore<span class="token operator">::</span><span class="token function">IMLibCoreRegisterCallback</span><span class="token punctuation">(</span>m_socketHandle<span class="token punctuation">,</span> <span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>util<span class="token operator">::</span><span class="token function">waitSingleObject</span><span class="token punctuation">(</span>m_eventConnected<span class="token punctuation">,</span> <span class="token number">5000</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        IM<span class="token operator">::</span>Login<span class="token operator">::</span>IMLoginReq imLoginReq<span class="token punctuation">;</span>
        string<span class="token operator">&amp;</span> name <span class="token operator">=</span> util<span class="token operator">::</span><span class="token function">cStringToString</span><span class="token punctuation">(</span>uName<span class="token punctuation">)</span><span class="token punctuation">;</span>
        imLoginReq<span class="token punctuation">.</span><span class="token function">set_user_name</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
        imLoginReq<span class="token punctuation">.</span><span class="token function">set_password</span><span class="token punctuation">(</span>pass<span class="token punctuation">)</span><span class="token punctuation">;</span>
        imLoginReq<span class="token punctuation">.</span><span class="token function">set_online_status</span><span class="token punctuation">(</span>IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>USER_STATUS_ONLINE<span class="token punctuation">)</span><span class="token punctuation">;</span>
        imLoginReq<span class="token punctuation">.</span><span class="token function">set_client_type</span><span class="token punctuation">(</span>IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>CLIENT_TYPE_WINDOWS<span class="token punctuation">)</span><span class="token punctuation">;</span>
        imLoginReq<span class="token punctuation">.</span><span class="token function">set_client_version</span><span class="token punctuation">(</span><span class="token string">&quot;win_10086&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token keyword">if</span> <span class="token punctuation">(</span>TCPCLIENT_STATE_OK <span class="token operator">!=</span> m_tcpClientState<span class="token punctuation">)</span>
            <span class="token keyword">return</span> <span class="token number">0</span><span class="token punctuation">;</span>

        <span class="token function">sendPacket</span><span class="token punctuation">(</span>IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>SID_LOGIN<span class="token punctuation">,</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>CID_LOGIN_REQ_USERLOGIN<span class="token punctuation">,</span> <span class="token operator">++</span>g_seqNum
            <span class="token punctuation">,</span> <span class="token operator">&amp;</span>imLoginReq<span class="token punctuation">)</span><span class="token punctuation">;</span>
        m_pImLoginResp<span class="token operator">-&gt;</span><span class="token function">Clear</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        util<span class="token operator">::</span><span class="token function">waitSingleObject</span><span class="token punctuation">(</span>m_eventReceived<span class="token punctuation">,</span> <span class="token number">10000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">return</span> m_pImLoginResp<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x8FD9;&#x6BB5;&#x4EE3;&#x7801;&#x5148;&#x8FDE;&#x63A5;&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x7136;&#x540E;&#x8C03;&#x7528;sendPacket()&#x53D1;&#x9001;&#x767B;&#x5F55;&#x6570;&#x636E;&#x5305;&#x3002;&#x5982;&#x4F55;&#x8FDE;&#x63A5;&#x670D;&#x52A1;&#x5668;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x4E9B;&#x201C;&#x5947;&#x6280;&#x6DEB;&#x5DE7;&#x201D;&#xFF0C;&#x6211;&#x4EEC;&#x540E;&#x9762;&#x5355;&#x72EC;&#x4ECB;&#x7ECD;&#x3002;&#x6211;&#x4EEC;&#x8FD9;&#x91CC;&#x5148;&#x6765;&#x770B;sendPacket()&#x53D1;&#x5305;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">TcpClientModule_Impl</span><span class="token operator">::</span><span class="token function">sendPacket</span><span class="token punctuation">(</span>UInt16 moduleId<span class="token punctuation">,</span> UInt16 cmdId<span class="token punctuation">,</span> UInt16 seq<span class="token punctuation">,</span> google<span class="token operator">::</span>protobuf<span class="token operator">::</span>MessageLite<span class="token operator">*</span> pbBody<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    m_TTPBHeader<span class="token punctuation">.</span><span class="token function">clear</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    m_TTPBHeader<span class="token punctuation">.</span><span class="token function">setModuleId</span><span class="token punctuation">(</span>moduleId<span class="token punctuation">)</span><span class="token punctuation">;</span>
    m_TTPBHeader<span class="token punctuation">.</span><span class="token function">setCommandId</span><span class="token punctuation">(</span>cmdId<span class="token punctuation">)</span><span class="token punctuation">;</span>
    m_TTPBHeader<span class="token punctuation">.</span><span class="token function">setSeqNumber</span><span class="token punctuation">(</span>seq<span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token function">_sendPacket</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">TcpClientModule_Impl</span><span class="token operator">::</span><span class="token function">_sendPacket</span><span class="token punctuation">(</span>google<span class="token operator">::</span>protobuf<span class="token operator">::</span>MessageLite<span class="token operator">*</span> pbBody<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    UInt32 length <span class="token operator">=</span> imcore<span class="token operator">::</span>HEADER_LENGTH <span class="token operator">+</span> pbBody<span class="token operator">-&gt;</span><span class="token function">ByteSize</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    m_TTPBHeader<span class="token punctuation">.</span><span class="token function">setLength</span><span class="token punctuation">(</span>length<span class="token punctuation">)</span><span class="token punctuation">;</span>
    std<span class="token operator">::</span>unique_ptr<span class="token operator">&lt;</span>byte<span class="token operator">&gt;</span> <span class="token function">data</span><span class="token punctuation">(</span><span class="token keyword">new</span> byte<span class="token punctuation">[</span>length<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">memset</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> length<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">memcpy</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> m_TTPBHeader<span class="token punctuation">.</span><span class="token function">getSerializeBuffer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>pbBody<span class="token operator">-&gt;</span><span class="token function">SerializeToArray</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">+</span> imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">,</span> pbBody<span class="token operator">-&gt;</span><span class="token function">ByteSize</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;pbBody SerializeToArray failed&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    imcore<span class="token operator">::</span><span class="token function">IMLibCoreWrite</span><span class="token punctuation">(</span>m_socketHandle<span class="token punctuation">,</span> data<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> length<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x5E8F;&#x5217;&#x5316;&#x6210;protobuf&#x8981;&#x6C42;&#x7684;&#x683C;&#x5F0F;&#xFF0C;&#x7136;&#x540E;&#x8C03;&#x7528;imcore::IMLibCoreWrite(m_socketHandle, data.get(), length);&#x53D1;&#x51FA;&#x53BB;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">int</span> <span class="token function">IMLibCoreWrite</span><span class="token punctuation">(</span><span class="token keyword">int</span> key<span class="token punctuation">,</span> uchar_t<span class="token operator">*</span> data<span class="token punctuation">,</span> <span class="token keyword">uint32_t</span> size<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">int</span> nRet <span class="token operator">=</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> nHandle <span class="token operator">=</span> key<span class="token punctuation">;</span>
    CImConn<span class="token operator">*</span> pConn <span class="token operator">=</span> <span class="token class-name">TcpSocketsManager</span><span class="token operator">::</span><span class="token function">getInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">get_client_conn</span><span class="token punctuation">(</span>nHandle<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>pConn<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        pConn<span class="token operator">-&gt;</span><span class="token function">Send</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token operator">*</span><span class="token punctuation">)</span>data<span class="token punctuation">,</span> size<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span> <span class="token punctuation">{</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span>  <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;connection is invalied:%d&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> key<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">return</span> nRet<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x5148;&#x5C1D;&#x8BD5;&#x7740;&#x76F4;&#x63A5;&#x53D1;&#x9001;&#xFF0C;&#x5982;&#x679C;&#x76EE;&#x524D;tcp&#x7A97;&#x53E3;&#x592A;&#x5C0F;&#x53D1;&#x4E0D;&#x51FA;&#x53BB;&#xFF0C;&#x5219;&#x6682;&#x4E14;&#x5C06;&#x6570;&#x636E;&#x653E;&#x5728;&#x53D1;&#x9001;&#x7F13;&#x51B2;&#x533A;&#x91CC;&#x9762;&#xFF0C;&#x5E76;&#x68C0;&#x6D4B;socket&#x53EF;&#x5199;&#x4E8B;&#x4EF6;&#x3002;&#x8FD9;&#x91CC;&#x5C31;&#x662F;&#x548C;&#x670D;&#x52A1;&#x5668;&#x4E00;&#x6837;&#x7684;&#x7F51;&#x7EDC;&#x5E93;&#x7684;&#x4EE3;&#x7801;&#x4E86;&#xFF0C;&#x524D;&#x9762;&#x4E00;&#x7CFB;&#x5217;&#x7684;&#x6587;&#x7AE0;&#xFF0C;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x4ECB;&#x7ECD;&#x8FC7;&#x4E86;&#x3002;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">int</span> <span class="token class-name">CImConn</span><span class="token operator">::</span><span class="token function">Send</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token operator">*</span> data<span class="token punctuation">,</span> <span class="token keyword">int</span> len<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>m_busy<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        m_out_buf<span class="token punctuation">.</span><span class="token function">Write</span><span class="token punctuation">(</span>data<span class="token punctuation">,</span> len<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> len<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">int</span> offset <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> remain <span class="token operator">=</span> len<span class="token punctuation">;</span>
    <span class="token keyword">while</span> <span class="token punctuation">(</span>remain <span class="token operator">&gt;</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">int</span> send_size <span class="token operator">=</span> remain<span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>send_size <span class="token operator">&gt;</span> NETLIB_MAX_SOCKET_BUF_SIZE<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            send_size <span class="token operator">=</span> NETLIB_MAX_SOCKET_BUF_SIZE<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>

        <span class="token keyword">int</span> ret <span class="token operator">=</span> <span class="token function">netlib_send</span><span class="token punctuation">(</span>m_handle<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token keyword">char</span><span class="token operator">*</span><span class="token punctuation">)</span>data <span class="token operator">+</span> offset<span class="token punctuation">,</span> send_size<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>ret <span class="token operator">&lt;=</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            ret <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>

        offset <span class="token operator">+=</span> ret<span class="token punctuation">;</span>
        remain <span class="token operator">-=</span> ret<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span>remain <span class="token operator">&gt;</span> <span class="token number">0</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        m_out_buf<span class="token punctuation">.</span><span class="token function">Write</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">char</span><span class="token operator">*</span><span class="token punctuation">)</span>data <span class="token operator">+</span> offset<span class="token punctuation">,</span> remain<span class="token punctuation">)</span><span class="token punctuation">;</span>
        m_busy <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span>  <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;send busy, remain=%d&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> m_out_buf<span class="token punctuation">.</span><span class="token function">GetWriteOffset</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">return</span> len<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x6570;&#x636E;&#x53D1;&#x51FA;&#x53BB;&#x4EE5;&#x540E;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x5E94;&#x7B54;&#x767B;&#x5F55;&#x5305;&#xFF0C;&#x7F51;&#x7EDC;&#x7EBF;&#x7A0B;&#x4F1A;&#x68C0;&#x6D4B;&#x5230;socket&#x53EF;&#x8BFB;&#x4E8B;&#x4EF6;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">CBaseSocket</span><span class="token operator">::</span><span class="token function">OnRead</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>m_state <span class="token operator">==</span> SOCKET_STATE_LISTENING<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">_AcceptNewSocket</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span>
    <span class="token punctuation">{</span>
        u_long avail <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span> <span class="token punctuation">(</span><span class="token function">ioctlsocket</span><span class="token punctuation">(</span>m_socket<span class="token punctuation">,</span> FIONREAD<span class="token punctuation">,</span> <span class="token operator">&amp;</span>avail<span class="token punctuation">)</span> <span class="token operator">==</span> SOCKET_ERROR<span class="token punctuation">)</span> <span class="token operator">||</span> <span class="token punctuation">(</span>avail <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token function">m_callback</span><span class="token punctuation">(</span>m_callback_data<span class="token punctuation">,</span> NETLIB_MSG_CLOSE<span class="token punctuation">,</span> <span class="token punctuation">(</span>net_handle_t<span class="token punctuation">)</span>m_socket<span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">else</span>
        <span class="token punctuation">{</span>
            <span class="token function">m_callback</span><span class="token punctuation">(</span>m_callback_data<span class="token punctuation">,</span> NETLIB_MSG_READ<span class="token punctuation">,</span> <span class="token punctuation">(</span>net_handle_t<span class="token punctuation">)</span>m_socket<span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token function">imconn_callback</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token operator">*</span> callback_data<span class="token punctuation">,</span> <span class="token keyword">uint8_t</span> msg<span class="token punctuation">,</span> <span class="token keyword">uint32_t</span> handle<span class="token punctuation">,</span> <span class="token keyword">void</span><span class="token operator">*</span> pParam<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token function">NOTUSED_ARG</span><span class="token punctuation">(</span>handle<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">NOTUSED_ARG</span><span class="token punctuation">(</span>pParam<span class="token punctuation">)</span><span class="token punctuation">;</span>

    CImConn<span class="token operator">*</span> pConn <span class="token operator">=</span> <span class="token class-name">TcpSocketsManager</span><span class="token operator">::</span><span class="token function">getInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">get_client_conn</span><span class="token punctuation">(</span>handle<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>pConn<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token comment">//LOG__(NET, _T(&quot;connection is invalied:%d&quot;), handle);</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    pConn<span class="token operator">-&gt;</span><span class="token function">AddRef</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">//    LOG__(NET,  &quot;msg=%d, handle=%d\n&quot;, msg, handle);</span>

    <span class="token keyword">switch</span> <span class="token punctuation">(</span>msg<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
    <span class="token keyword">case</span> NETLIB_MSG_CONFIRM<span class="token operator">:</span>
        pConn<span class="token operator">-&gt;</span><span class="token function">onConnect</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> NETLIB_MSG_READ<span class="token operator">:</span>
        pConn<span class="token operator">-&gt;</span><span class="token function">OnRead</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> NETLIB_MSG_WRITE<span class="token operator">:</span>
        pConn<span class="token operator">-&gt;</span><span class="token function">OnWrite</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> NETLIB_MSG_CLOSE<span class="token operator">:</span>
        pConn<span class="token operator">-&gt;</span><span class="token function">OnClose</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">default</span><span class="token operator">:</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span>  <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;!!!imconn_callback error msg: %d&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> msg<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    pConn<span class="token operator">-&gt;</span><span class="token function">ReleaseRef</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">CImConn</span><span class="token operator">::</span><span class="token function">OnRead</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token punctuation">;</span><span class="token punctuation">;</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">uint32_t</span> free_buf_len <span class="token operator">=</span> m_in_buf<span class="token punctuation">.</span><span class="token function">GetAllocSize</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">-</span> m_in_buf<span class="token punctuation">.</span><span class="token function">GetWriteOffset</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>free_buf_len <span class="token operator">&lt;</span> READ_BUF_SIZE<span class="token punctuation">)</span>
            m_in_buf<span class="token punctuation">.</span><span class="token function">Extend</span><span class="token punctuation">(</span>READ_BUF_SIZE<span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token keyword">int</span> ret <span class="token operator">=</span> <span class="token function">netlib_recv</span><span class="token punctuation">(</span>m_handle<span class="token punctuation">,</span> m_in_buf<span class="token punctuation">.</span><span class="token function">GetBuffer</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">+</span> m_in_buf<span class="token punctuation">.</span><span class="token function">GetWriteOffset</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> READ_BUF_SIZE<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>ret <span class="token operator">&lt;=</span> <span class="token number">0</span><span class="token punctuation">)</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>

        m_in_buf<span class="token punctuation">.</span><span class="token function">IncWriteOffset</span><span class="token punctuation">(</span>ret<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">while</span> <span class="token punctuation">(</span>m_in_buf<span class="token punctuation">.</span><span class="token function">GetWriteOffset</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">&gt;=</span> imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token keyword">uint32_t</span> len <span class="token operator">=</span> m_in_buf<span class="token punctuation">.</span><span class="token function">GetWriteOffset</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">uint32_t</span> length <span class="token operator">=</span> <span class="token class-name">CByteStream</span><span class="token operator">::</span><span class="token function">ReadUint32</span><span class="token punctuation">(</span>m_in_buf<span class="token punctuation">.</span><span class="token function">GetBuffer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>length <span class="token operator">&gt;</span> len<span class="token punctuation">)</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>

            <span class="token keyword">try</span>
            <span class="token punctuation">{</span>
                imcore<span class="token operator">::</span>TTPBHeader pbHeader<span class="token punctuation">;</span>
                pbHeader<span class="token punctuation">.</span><span class="token function">unSerialize</span><span class="token punctuation">(</span><span class="token punctuation">(</span>byte<span class="token operator">*</span><span class="token punctuation">)</span>m_in_buf<span class="token punctuation">.</span><span class="token function">GetBuffer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">LOG__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;OnRead moduleId:0x%x,commandId:0x%x&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> pbHeader<span class="token punctuation">.</span><span class="token function">getModuleId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> pbHeader<span class="token punctuation">.</span><span class="token function">getCommandId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span>m_pTcpSocketCB<span class="token punctuation">)</span>
                    m_pTcpSocketCB<span class="token operator">-&gt;</span><span class="token function">onReceiveData</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span><span class="token operator">*</span><span class="token punctuation">)</span>m_in_buf<span class="token punctuation">.</span><span class="token function">GetBuffer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> length<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">LOGBIN_F__</span><span class="token punctuation">(</span>SOCK<span class="token punctuation">,</span> <span class="token string">&quot;OnRead&quot;</span><span class="token punctuation">,</span> m_in_buf<span class="token punctuation">.</span><span class="token function">GetBuffer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> length<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
            <span class="token keyword">catch</span> <span class="token punctuation">(</span>std<span class="token operator">::</span>exception<span class="token operator">&amp;</span> ex<span class="token punctuation">)</span>
            <span class="token punctuation">{</span>
                <span class="token function">assert</span><span class="token punctuation">(</span>FALSE<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">LOGA__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span> <span class="token string">&quot;std::exception,info:%s&quot;</span><span class="token punctuation">,</span> ex<span class="token punctuation">.</span><span class="token function">what</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span>m_pTcpSocketCB<span class="token punctuation">)</span>
                    m_pTcpSocketCB<span class="token operator">-&gt;</span><span class="token function">onReceiveError</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
            <span class="token keyword">catch</span> <span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span>
            <span class="token punctuation">{</span>
                <span class="token function">assert</span><span class="token punctuation">(</span>FALSE<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">LOG__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;unknown exception&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span>m_pTcpSocketCB<span class="token punctuation">)</span>
                    m_pTcpSocketCB<span class="token operator">-&gt;</span><span class="token function">onReceiveError</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
            m_in_buf<span class="token punctuation">.</span><span class="token function">Read</span><span class="token punctuation">(</span><span class="token constant">NULL</span><span class="token punctuation">,</span> length<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x6536;&#x53D6;&#x6570;&#x636E;&#xFF0C;&#x5E76;&#x89E3;&#x5305;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">TcpClientModule_Impl</span><span class="token operator">::</span><span class="token function">onReceiveData</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span><span class="token operator">*</span> data<span class="token punctuation">,</span> <span class="token keyword">int32_t</span> size<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>m_pServerPingTimer<span class="token punctuation">)</span>
        m_pServerPingTimer<span class="token operator">-&gt;</span>m_bHasReceivedPing <span class="token operator">=</span> TRUE<span class="token punctuation">;</span>

    imcore<span class="token operator">::</span>TTPBHeader header<span class="token punctuation">;</span>
    header<span class="token punctuation">.</span><span class="token function">unSerialize</span><span class="token punctuation">(</span><span class="token punctuation">(</span>byte<span class="token operator">*</span><span class="token punctuation">)</span>data<span class="token punctuation">,</span> imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">)</span><span class="token punctuation">;</span>    
    <span class="token keyword">if</span> <span class="token punctuation">(</span>IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>CID_OTHER_HEARTBEAT <span class="token operator">==</span> header<span class="token punctuation">.</span><span class="token function">getCommandId</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">&amp;&amp;</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>SID_OTHER <span class="token operator">==</span> header<span class="token punctuation">.</span><span class="token function">getModuleId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token comment">//&#x6A21;&#x5757;&#x5668;&#x7AEF;&#x8FC7;&#x6765;&#x7684;&#x5FC3;&#x8DF3;&#x5305;&#xFF0C;&#x4E0D;&#x8DF3;&#x5230;&#x4E1A;&#x52A1;&#x5C42;&#x6D3E;&#x53D1;</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token function">LOG__</span><span class="token punctuation">(</span>NET<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;receiveData message moduleId:0x%x,commandId:0x%x&quot;</span><span class="token punctuation">)</span>
        <span class="token punctuation">,</span> header<span class="token punctuation">.</span><span class="token function">getModuleId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> header<span class="token punctuation">.</span><span class="token function">getCommandId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span>g_seqNum <span class="token operator">==</span> header<span class="token punctuation">.</span><span class="token function">getSeqNumber</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        m_pImLoginResp<span class="token operator">-&gt;</span><span class="token function">ParseFromArray</span><span class="token punctuation">(</span>data <span class="token operator">+</span> imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">,</span> size <span class="token operator">-</span> imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token operator">::</span><span class="token function">SetEvent</span><span class="token punctuation">(</span>m_eventReceived<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token comment">//&#x5C06;&#x7F51;&#x7EDC;&#x5305;&#x5305;&#x88C5;&#x6210;&#x4EFB;&#x52A1;&#x653E;&#x5230;&#x903B;&#x8F91;&#x4EFB;&#x52A1;&#x961F;&#x5217;&#x91CC;&#x9762;&#x53BB;</span>
    <span class="token function">_handlePacketOperation</span><span class="token punctuation">(</span>data<span class="token punctuation">,</span> size<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">TcpClientModule_Impl</span><span class="token operator">::</span><span class="token function">_handlePacketOperation</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span><span class="token operator">*</span> data<span class="token punctuation">,</span> UInt32 size<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    std<span class="token operator">::</span>string <span class="token function">copyInBuffer</span><span class="token punctuation">(</span>data<span class="token punctuation">,</span> size<span class="token punctuation">)</span><span class="token punctuation">;</span>
    imcore<span class="token operator">::</span><span class="token function">IMLibCoreStartOperationWithLambda</span><span class="token punctuation">(</span>
        <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        imcore<span class="token operator">::</span>TTPBHeader header<span class="token punctuation">;</span>
        header<span class="token punctuation">.</span><span class="token function">unSerialize</span><span class="token punctuation">(</span><span class="token punctuation">(</span>byte<span class="token operator">*</span><span class="token punctuation">)</span>copyInBuffer<span class="token punctuation">.</span><span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">)</span><span class="token punctuation">;</span>

        module<span class="token operator">::</span>IPduPacketParse<span class="token operator">*</span> pModule
            <span class="token operator">=</span> <span class="token punctuation">(</span>module<span class="token operator">::</span>IPduPacketParse<span class="token operator">*</span><span class="token punctuation">)</span><span class="token function">__getModule</span><span class="token punctuation">(</span>header<span class="token punctuation">.</span><span class="token function">getModuleId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>pModule<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token function">assert</span><span class="token punctuation">(</span>FALSE<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;module is null, moduleId:%d,commandId:%d&quot;</span><span class="token punctuation">)</span>
                <span class="token punctuation">,</span> header<span class="token punctuation">.</span><span class="token function">getModuleId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> header<span class="token punctuation">.</span><span class="token function">getCommandId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">return</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        std<span class="token operator">::</span>string <span class="token function">pbBody</span><span class="token punctuation">(</span>copyInBuffer<span class="token punctuation">.</span><span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">+</span> imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">,</span> size <span class="token operator">-</span> imcore<span class="token operator">::</span>HEADER_LENGTH<span class="token punctuation">)</span><span class="token punctuation">;</span>
        pModule<span class="token operator">-&gt;</span><span class="token function">onPacket</span><span class="token punctuation">(</span>header<span class="token punctuation">,</span> pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x6839;&#x636E;&#x4E0D;&#x540C;&#x7684;&#x547D;&#x4EE4;&#x53F7;&#x6765;&#x505A;&#x76F8;&#x5E94;&#x7684;&#x5904;&#x7406;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">UserListModule_Impl</span><span class="token operator">::</span><span class="token function">onPacket</span><span class="token punctuation">(</span>imcore<span class="token operator">::</span>TTPBHeader<span class="token operator">&amp;</span> header<span class="token punctuation">,</span> std<span class="token operator">::</span>string<span class="token operator">&amp;</span> pbBody<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">switch</span> <span class="token punctuation">(</span>header<span class="token punctuation">.</span><span class="token function">getCommandId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_RECENT_CONTACT_SESSION_RESPONSE<span class="token operator">:</span>
        <span class="token function">_recentlistResponse</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_STATUS_NOTIFY<span class="token operator">:</span>
        <span class="token function">_userStatusNotify</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_USER_INFO_RESPONSE<span class="token operator">:</span>
        <span class="token function">_usersInfoResponse</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_REMOVE_SESSION_RES<span class="token operator">:</span>
        <span class="token function">_removeSessionResponse</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_ALL_USER_RESPONSE<span class="token operator">:</span>
        <span class="token function">_allUserlistResponse</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_USERS_STATUS_RESPONSE<span class="token operator">:</span>
        <span class="token function">_usersLineStatusResponse</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_CHANGE_AVATAR_RESPONSE<span class="token operator">:</span>
        <span class="token function">_changeAvatarResponse</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span>  IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>CID_BUDDY_LIST_REMOVE_SESSION_NOTIFY<span class="token operator">:</span>
        <span class="token function">_removeSessionNotify</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>CID_BUDDY_LIST_DEPARTMENT_RESPONSE<span class="token operator">:</span>
        <span class="token function">_departmentResponse</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_AVATAR_CHANGED_NOTIFY<span class="token operator">:</span>
        <span class="token function">_avatarChangeNotify</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_CHANGE_SIGN_INFO_RESPONSE<span class="token operator">:</span>
        <span class="token function">_changeSignInfoResponse</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">case</span> IM<span class="token operator">::</span>BaseDefine<span class="token operator">::</span>BuddyListCmdID<span class="token operator">::</span>CID_BUDDY_LIST_SIGN_INFO_CHANGED_NOTIFY<span class="token operator">:</span>
        <span class="token function">_signInfoChangedNotify</span><span class="token punctuation">(</span>pbBody<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token keyword">default</span><span class="token operator">:</span>
        <span class="token function">LOG__</span><span class="token punctuation">(</span>ERR<span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;Unknow commandID:%d&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> header<span class="token punctuation">.</span><span class="token function">getCommandId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x6BCF;&#x4E00;&#x4E2A;&#x5904;&#x7406;&#x5206;&#x652F;&#xFF0C;&#x90FD;&#x6700;&#x7EC8;&#x4F1A;&#x4EA7;&#x751F;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#x653E;&#x5165;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x7684;&#x6D88;&#x606F;&#x961F;&#x5217;&#x4E2D;&#x3002;&#x8FD9;&#x524D;&#x9762;&#x5DF2;&#x7ECF;&#x4ECB;&#x7ECD;&#x8FC7;&#x4E86;&#x3002;&#x8FD9;&#x91CC;&#x6211;&#x4E0D;&#x5F97;&#x4E0D;&#x8BF4;&#x4E00;&#x70B9;&#xFF0C;teamtalk&#x5BF9;&#x4E8E;&#x5176;&#x5B83;&#x6570;&#x636E;&#x5305;&#x7684;&#x5E94;&#x7B54;&#x90FD;&#x662F;&#x8D70;&#x7684;&#x4E0A;&#x9762;&#x7684;&#x4ECB;&#x7ECD;&#x7684;&#x6D41;&#x7A0B;&#xFF0C;&#x4F46;&#x662F;&#x5BF9;&#x4E8E;&#x767B;&#x5F55;&#x7684;&#x5E94;&#x7B54;&#x5374;&#x662F;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x4E9B;&#x7279;&#x6B8A;&#x5904;&#x7406;&#x3002;&#x542C;&#x6211;&#x6162;&#x6162;&#x9053;&#x6765;&#xFF1A;</p>
<p><img src="../imgs/tt28.png" alt=""></p>
<p>&#x4E0A;&#x6587;&#x4E2D;&#x53D1;&#x9001;&#x4E86;&#x767B;&#x5F55;&#x6570;&#x636E;&#x5305;&#x4E4B;&#x540E;&#xFF0C;&#x5728;&#x90A3;&#x91CC;&#x7B49;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;10&#x79D2;&#x949F;&#xFF0C;&#x5982;&#x679C;10&#x79D2;&#x5185;&#x8FD9;&#x4E2A;&#x4E8B;&#x4EF6;&#x6709;&#x4FE1;&#x53F7;&#xFF0C;&#x5219;&#x8BA4;&#x4E3A;&#x767B;&#x5F55;&#x6210;&#x529F;&#x3002;&#x90A3;&#x4E48;&#x4EC0;&#x4E48;&#x60C5;&#x51B5;&#x8BE5;&#x4E8B;&#x4EF6;&#x4F1A;&#x6709;&#x4FE1;&#x53F7;&#x5462;&#xFF1F;</p>
<p>&#x8BE5;&#x4E8B;&#x4EF6;&#x5728;&#x6784;&#x9020;&#x51FD;&#x6570;&#x91CC;&#x9762;&#x521B;&#x5EFA;&#xFF0C;&#x9ED8;&#x8BA4;&#x65E0;&#x4FE1;&#x53F7;&#xFF1A;</p>
<p><img src="../imgs/tt29.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p>&#x5F53;&#x7F51;&#x7EDC;&#x7EBF;&#x7A0B;&#x6536;&#x5230;&#x6570;&#x636E;&#x4EE5;&#x540E;&#xFF08;&#x4E0A;&#x6587;&#x903B;&#x8F91;&#x6D41;&#x4E2D;&#x4ECB;&#x7ECD;&#x8FC7;&#x4E86;&#xFF09;&#xFF1A;</p>
<p><img src="../imgs/tt30.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p>&#x9664;&#x4E86;&#x5FC3;&#x8DF3;&#x5305;&#x76F4;&#x63A5;&#x8FC7;&#x6EE4;&#x4EE5;&#x5916;&#xFF0C;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x5E8F;&#x5217;&#x53F7;&#xFF08;Seq&#xFF0C;&#x53D8;&#x91CF;g_seqNum&#xFF09;&#x552F;&#x4E00;&#x6807;&#x8BC6;&#x4E86;&#x767B;&#x5F55;&#x6570;&#x636E;&#x5305;&#x7684;&#x5E94;&#x7B54;&#xFF0C;&#x5982;&#x679C;&#x6536;&#x5230;&#x8FD9;&#x4E2A;&#x5E8F;&#x5217;&#x53F7;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x5219;&#x7F6E;&#x4FE1;m_eventReceived&#x3002;&#x8FD9;&#x6837;&#x7B49;&#x5F85;&#x5728;&#x90A3;&#x91CC;&#x7684;&#x767B;&#x5F55;&#x6D41;&#x7A0B;&#x5C31;&#x53EF;&#x4EE5;&#x8FD4;&#x56DE;&#x4E86;&#xFF0C;&#x540C;&#x65F6;&#x4E5F;&#x5F97;&#x5230;&#x4E86;&#x767B;&#x5F55;&#x5E94;&#x7B54;&#xFF0C;&#x767B;&#x5F55;&#x5E94;&#x7B54;&#x6570;&#x636E;&#x8BB0;&#x5F55;&#x5728;&#x6210;&#x5458;&#x53D8;&#x91CF;m_pImLoginResp&#x4E2D;&#x3002;&#x5982;&#x679C;&#x662F;&#x5176;&#x5B83;&#x7684;&#x6570;&#x636E;&#x5305;&#xFF0C;&#x5219;&#x8D70;&#x7684;&#x6D41;&#x7A0B;&#x662F;_handlePacketOperation(data, size);&#xFF0C;&#x5904;&#x7406;&#x903B;&#x8F91;&#x4E0A;&#x6587;&#x4E5F;&#x4ECB;&#x7ECD;&#x4E86;&#x3002;</p>
<p>&#x81F3;&#x6B64;&#xFF0C;&#x6574;&#x4E2A;&#x5BA2;&#x6237;&#x7AEF;&#x7A0B;&#x5E8F;&#x7ED3;&#x6784;&#x5C31;&#x4ECB;&#x7ECD;&#x5B8C;&#x4E86;&#xFF0C;&#x6211;&#x4EEC;&#x603B;&#x7ED3;&#x4E00;&#x4E0B;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;&#x7A0B;&#x5E8F;&#x6709;&#x5982;&#x4E0B;&#x51E0;&#x7C7B;&#x7EBF;&#x7A0B;&#xFF1A;</p>
<ol>
<li><p>&#x7F51;&#x7EDC;&#x4E8B;&#x4EF6;&#x68C0;&#x6D4B;&#x7EBF;&#x7A0B;&#xFF0C;&#x7528;&#x4E8E;&#x63A5;&#x6536;&#x548C;&#x53D1;&#x9001;&#x7F51;&#x7EDC;&#x6570;&#x636E;&#xFF1B;</p>
</li>
<li><p>http&#x4EFB;&#x52A1;&#x5904;&#x7406;&#x7EBF;&#x7A0B;&#x7528;&#x4E8E;&#x5904;&#x7406;http&#x64CD;&#x4F5C;&#xFF1B;</p>
</li>
<li><p>&#x666E;&#x901A;&#x7684;&#x4EFB;&#x52A1;&#x5904;&#x7406;&#x7EBF;&#x7A0B;&#xFF0C;&#x7528;&#x4E8E;&#x5904;&#x7406;&#x4E00;&#x822C;&#x6027;&#x7684;&#x4EFB;&#x52A1;&#xFF0C;&#x6BD4;&#x5982;&#x767B;&#x5F55;&#xFF1B;</p>
</li>
<li><p>UI&#x7EBF;&#x7A0B;&#xFF0C;&#x754C;&#x9762;&#x903B;&#x8F91;&#x5904;&#x7406;&#xFF0C;&#x540C;&#x65F6;&#x5728;UI&#x7EBF;&#x7A0B;&#x91CC;&#x9762;&#x6709;&#x4E00;&#x4E2A;&#x4EE3;&#x7406;&#x7A97;&#x53E3;&#x7684;&#x7A97;&#x53E3;&#x8FC7;&#x7A0B;&#x51FD;&#x6570;&#xFF0C;&#x7528;&#x4E8E;&#x975E;UI&#x7EBF;&#x7A0B;&#x4E0E;UI&#x7EBF;&#x7A0B;&#x4E4B;&#x95F4;&#x7684;&#x6570;&#x636E;&#x6D41;&#x548C;&#x903B;&#x8F91;&#x4E2D;&#x8F6C;&#xFF0C;&#x6838;&#x5FC3;&#x662F;&#x5229;&#x7528;PostMessage&#x5F80;&#x4EE3;&#x7406;&#x7EBF;&#x7A0B;&#x6295;&#x9012;&#x4E8B;&#x4EF6;&#xFF0C;&#x4E8B;&#x4EF6;&#x6D88;&#x606F;&#x53C2;&#x6570;&#x643A;&#x5E26;&#x4EFB;&#x52A1;&#x4FE1;&#x606F;&#x3002;</p>
</li>
</ol>
<p>&#x81F3;&#x4E8E;&#xFF0C;&#x50CF;&#x804A;&#x5929;&#x3001;&#x67E5;&#x770B;&#x7528;&#x6237;&#x4FE1;&#x606F;&#x8FD9;&#x4E9B;&#x4E1A;&#x52A1;&#x6027;&#x7684;&#x5185;&#x5BB9;&#xFF0C;&#x7559;&#x7ED9;&#x6709;&#x5174;&#x8DA3;&#x7684;&#x8BFB;&#x8005;&#x81EA;&#x5DF1;&#x53BB;&#x7814;&#x7A76;&#x5427;&#x3002;</p>
<h3 id="&#x56DB;&#x3001;&#x7A0B;&#x5E8F;&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x6BD4;&#x8F83;&#x6709;&#x610F;&#x601D;&#x7684;&#x6280;&#x5DE7;&#x6458;&#x5F55;"><a name="&#x56DB;&#x3001;&#x7A0B;&#x5E8F;&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x6BD4;&#x8F83;&#x6709;&#x610F;&#x601D;&#x7684;&#x6280;&#x5DE7;&#x6458;&#x5F55;" class="anchor-navigation-ex-anchor" href="#&#x56DB;&#x3001;&#x7A0B;&#x5E8F;&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x6BD4;&#x8F83;&#x6709;&#x610F;&#x601D;&#x7684;&#x6280;&#x5DE7;&#x6458;&#x5F55;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x56DB;&#x3001;&#x7A0B;&#x5E8F;&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x6BD4;&#x8F83;&#x6709;&#x610F;&#x601D;&#x7684;&#x6280;&#x5DE7;&#x6458;&#x5F55;</h3>
<ol>
<li>&#x552F;&#x4E00;&#x5B9E;&#x4F8B;&#x5224;&#x65AD;</li>
</ol>
<p>&#x5F88;&#x591A;&#x7A0B;&#x5E8F;&#x53EA;&#x80FD;&#x542F;&#x52A8;&#x4E00;&#x4E2A;&#x5B9E;&#x4F8B;&#xFF0C;&#x5F53;&#x4F60;&#x518D;&#x6B21;&#x542F;&#x52A8;&#x67D0;&#x4E2A;&#x7A0B;&#x5E8F;&#x7684;&#x5B9E;&#x4F8B;&#x65F6;&#xFF0C;&#x4F1A;&#x6FC0;&#x6D3B;&#x524D;&#x4E00;&#x4E2A;&#x5B9E;&#x4F8B;&#xFF0C;&#x5176;&#x5B9E;&#x5B9E;&#x73B0;&#x8D77;&#x6765;&#x5F88;&#x7B80;&#x5355;&#xFF0C;&#x5C31;&#x662F;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#x547D;&#x540D;&#x7684;Mutex&#xFF0C;&#x56E0;&#x4E3A;Mutex&#x53EF;&#x4EE5;&#x8DE8;&#x8FDB;&#x7A0B;&#xFF0C;&#x5F53;&#x518D;&#x6B21;&#x542F;&#x52A8;&#x7A0B;&#x5E8F;&#x5B9E;&#x4F8B;&#x65F6;&#xFF0C;&#x521B;&#x5EFA;&#x540C;&#x540D;&#x7684;Mutex&#xFF0C;&#x4F1A;&#x65E0;&#x6CD5;&#x521B;&#x5EFA;&#xFF0C;&#x9519;&#x8BEF;&#x4FE1;&#x606F;&#x662F;&#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#x3002;&#x8FD9;&#x662F;windows&#x4E0A;&#x975E;&#x5E38;&#x5E38;&#x7528;&#x7684;&#x6280;&#x5DE7;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x4ECE;&#x4E8B;windows&#x5F00;&#x53D1;&#xFF0C;&#x8BF7;&#x4F60;&#x52A1;&#x5FC5;&#x638C;&#x63E1;&#x5B83;&#x3002;&#x770B;teamtalk&#x7684;&#x5B9E;&#x73B0;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">ifdef</span> <span class="token expression">_DEBUG</span></span>
    <span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span>  <span class="token expression">AppSingletonMutex <span class="token function">_T</span><span class="token punctuation">(</span></span><span class="token string">&quot;{7A666640-EDB3-44CC-954B-0C43F35A2E17}&quot;</span><span class="token expression"><span class="token punctuation">)</span></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">else</span></span>
    <span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span>  <span class="token expression">AppSingletonMutex <span class="token function">_T</span><span class="token punctuation">(</span></span><span class="token string">&quot;{5676532A-6F70-460D-A1F0-81D6E68F046A}&quot;</span><span class="token expression"><span class="token punctuation">)</span></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">endif</span></span>
BOOL <span class="token class-name">CteamtalkApp</span><span class="token operator">::</span><span class="token function">_IsHaveInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token comment">// &#x5355;&#x5B9E;&#x4F8B;&#x8FD0;&#x884C;</span>
    HANDLE hMutex <span class="token operator">=</span> <span class="token operator">::</span><span class="token function">CreateMutex</span><span class="token punctuation">(</span><span class="token constant">NULL</span><span class="token punctuation">,</span> TRUE<span class="token punctuation">,</span> AppSingletonMutex<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>hMutex <span class="token operator">!=</span> <span class="token constant">NULL</span> <span class="token operator">&amp;&amp;</span> <span class="token function">GetLastError</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">==</span> ERROR_ALREADY_EXISTS<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token function">MessageBox</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;&#x4E0A;&#x6B21;&#x7A0B;&#x5E8F;&#x8FD0;&#x884C;&#x8FD8;&#x6CA1;&#x5B8C;&#x5168;&#x9000;&#x51FA;&#xFF0C;&#x8BF7;&#x7A0D;&#x540E;&#x518D;&#x542F;&#x52A8;&#xFF01;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">_T</span><span class="token punctuation">(</span><span class="token string">&quot;TeamTalk&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span> MB_OK<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> TRUE<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">return</span> FALSE<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<ol>
<li><p>socket&#x51FD;&#x6570;connect()&#x8FDE;&#x63A5;&#x7B49;&#x5F85;&#x65F6;&#x957F;&#x8BBE;&#x5B9A;</p>
<p>&#x4F20;&#x7EDF;&#x7684;&#x505A;&#x6CD5;&#x662F;&#x5C06;socket&#x8BBE;&#x7F6E;&#x4E3A;&#x975E;&#x963B;&#x585E;&#x7684;&#xFF0C;&#x8C03;&#x7528;&#x5B8C;connect&#x51FD;&#x6570;&#x4E4B;&#x540E;&#xFF0C;&#x8C03;&#x7528;select&#x51FD;&#x6570;&#x68C0;&#x6D4B;socket&#x662F;&#x5426;&#x53EF;&#x5199;&#xFF0C;&#x5728;select&#x51FD;&#x6570;&#x91CC;&#x9762;&#x8BBE;&#x7F6E;&#x8D85;&#x65F6;&#x65F6;&#x95F4;&#x3002;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
</li>
</ol>
<pre class="language-"><code class="lang-cpp"><span class="token comment">//&#x4E3A;&#x4E86;&#x8C03;&#x8BD5;&#x65B9;&#x4FBF;&#xFF0C;&#x6682;&#x4E14;&#x6CE8;&#x91CA;&#x6389;</span>
<span class="token keyword">int</span> ret <span class="token operator">=</span> <span class="token operator">::</span><span class="token function">connect</span><span class="token punctuation">(</span>m_hSocket<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">sockaddr</span><span class="token operator">*</span><span class="token punctuation">)</span><span class="token operator">&amp;</span>addrSrv<span class="token punctuation">,</span> <span class="token keyword">sizeof</span><span class="token punctuation">(</span>addrSrv<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>ret <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    m_bConnected <span class="token operator">=</span> TRUE<span class="token punctuation">;</span>
    <span class="token keyword">return</span> TRUE<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token keyword">if</span> <span class="token punctuation">(</span>ret <span class="token operator">==</span> SOCKET_ERROR <span class="token operator">&amp;&amp;</span> <span class="token function">WSAGetLastError</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">!=</span> WSAEWOULDBLOCK<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">return</span> FALSE<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

fd_set writeset<span class="token punctuation">;</span>
<span class="token function">FD_ZERO</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>writeset<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">FD_SET</span><span class="token punctuation">(</span>m_hSocket<span class="token punctuation">,</span> <span class="token operator">&amp;</span>writeset<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">struct</span> <span class="token class-name">timeval</span> tv <span class="token operator">=</span> <span class="token punctuation">{</span> timeout<span class="token punctuation">,</span> <span class="token number">0</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">::</span><span class="token function">select</span><span class="token punctuation">(</span>m_hSocket <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">,</span> <span class="token operator">&amp;</span>writeset<span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">,</span> <span class="token operator">&amp;</span>tv<span class="token punctuation">)</span> <span class="token operator">!=</span> <span class="token number">1</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">return</span> FALSE<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token keyword">return</span> TRUE<span class="token punctuation">;</span>
</code></pre>
<p>&#x6211;&#x4EEC;&#x770B;&#x770B;teamtalk&#x91CC;&#x9762;&#x600E;&#x4E48;&#x505A;&#x7684;&#xFF1A;</p>
<p><img src="../imgs/tt31.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;">&#x200B;</p>
<p>&#x7EA2;&#x8272;&#x7BAD;&#x5934;&#x7684;&#x5730;&#x65B9;&#x8C03;&#x7528;connect&#x51FD;&#x6570;&#x8FDE;&#x63A5;&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x7136;&#x540E;&#x7EFF;&#x8272;&#x7684;&#x7BAD;&#x5934;&#x7B49;&#x5F85;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#x6709;&#x4FE1;&#x53F7;&#xFF08;&#x5185;&#x90E8;&#x4F7F;&#x7528;WaitForSingleObject&#x51FD;&#x6570;&#xFF09;&#xFF0C;&#x90A3;&#x4E8B;&#x4EF6;&#x4EC0;&#x4E48;&#x65F6;&#x5019;&#x6709;&#x4FE1;&#x53F7;&#x5462;&#xFF1F;</p>
<p><img src="../imgs/tt32.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p>&#x7F51;&#x7EDC;&#x7EBF;&#x7A0B;&#x68C0;&#x6D4B;&#x7B2C;&#x4E00;&#x6B21;&#x5230;socket&#x53EF;&#x5199;&#x65F6;&#xFF0C;&#x8C03;&#x7528;onConnectDone&#x51FD;&#x6570;&#xFF1A;</p>
<p><img src="../imgs/tt33.png" alt=""><img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"></p>
<p>&#x5B9E;&#x9645;&#x505A;&#x7684;&#x4E8B;&#x60C5;&#x8FD8;&#x662F;&#x548C;&#x4E0A;&#x9762;&#x4ECB;&#x7ECD;&#x7684;&#x5DEE;&#x4E0D;&#x591A;&#x3002;&#x5176;&#x5B9E;&#x5BF9;&#x4E8E;&#x767B;&#x5F55;&#x6D41;&#x7A0B;&#x505A;&#x6210;&#x540C;&#x6B65;&#x7684;&#xFF0C;&#x4E5F;&#x662F;&#x548C;&#x8FD9;&#x4E2A;&#x7C7B;&#x4F3C;&#xFF0C;&#x4E0A;&#x6587;&#x4E2D;&#x6211;&#x4EEC;&#x4ECB;&#x7ECD;&#x8FC7;&#x3002;&#x6211;&#x65E9;&#x4E9B;&#x5E74;&#x521A;&#x505A;windows&#x7F51;&#x7EDC;&#x901A;&#x4FE1;&#x65B9;&#x9762;&#x7684;&#x9879;&#x76EE;&#x65F6;&#xFF0C;&#x5F00;&#x59CB;&#x603B;&#x662F;&#x627E;&#x4E0D;&#x5230;&#x597D;&#x7684;&#x5904;&#x7406;&#x7B49;&#x5F85;&#x767B;&#x5F55;&#x8BF7;&#x6C42;&#x5E94;&#x7B54;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x8FD9;&#x91CC;&#x662F;&#x4E00;&#x79CD;&#x5F88;&#x4E0D;&#x9519;&#x7684;&#x8BBE;&#x7F6E;&#x8D85;&#x65F6;&#x7B49;&#x5F85;&#x7684;&#x65B9;&#x6CD5;&#x3002;</p>
<ol>
<li>teamtalk&#x7684;&#x622A;&#x56FE;&#x529F;&#x80FD;</li>
</ol>
<p>&#x4E0D;&#x77E5;&#x9053;&#xFF0C;&#x4F60;&#x5728;&#x4F7F;&#x7528;qq&#x8FD9;&#x6837;&#x7684;&#x622A;&#x56FE;&#x5DE5;&#x5177;&#x65F6;&#xFF0C;QQ&#x622A;&#x56FE;&#x5DE5;&#x5177;&#x80FD;&#x81EA;&#x52A8;&#x68C0;&#x6D4B;&#x51FA;&#x67D0;&#x4E2A;&#x7A97;&#x53E3;&#x7684;&#x8303;&#x56F4;&#x3002;&#x8FD9;&#x4E2A;&#x529F;&#x80FD;&#x5728;teamtalk&#x4E2D;&#x4E5F;&#x6709;&#x5B9E;&#x73B0;&#xFF0C;&#x5B9E;&#x73B0;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">BOOL <span class="token class-name">ScreenCapture</span><span class="token operator">::</span><span class="token function">initCapture</span><span class="token punctuation">(</span>__in HWND hWnd<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token comment">//register hot key</span>
    <span class="token keyword">const</span> std<span class="token operator">::</span>wstring screenCaptureHotkeyName <span class="token operator">=</span> L<span class="token string">&quot;_SCREEN_CAPTURE_HOTKEY&quot;</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> iHotkeyId <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">)</span><span class="token function">GlobalAddAtom</span><span class="token punctuation">(</span>screenCaptureHotkeyName<span class="token punctuation">.</span><span class="token function">c_str</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token function">RegisterHotKey</span><span class="token punctuation">(</span>hWnd<span class="token punctuation">,</span> iHotkeyId<span class="token punctuation">,</span> MOD_CONTROL <span class="token operator">|</span> MOD_SHIFT<span class="token punctuation">,</span> <span class="token number">0x51</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token comment">//ctrl + shift + Q</span>
    <span class="token punctuation">{</span>
        <span class="token function">GlobalDeleteAtom</span><span class="token punctuation">(</span>iHotkeyId<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    m_iHotkeyId <span class="token operator">=</span> iHotkeyId<span class="token punctuation">;</span>
    m_hRegisterHotkeyWnd <span class="token operator">=</span> hWnd<span class="token punctuation">;</span>

    <span class="token keyword">return</span> <span class="token function">createMsgWindow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x7A0B;&#x5E8F;&#x521D;&#x59CB;&#x5316;&#x65F6;&#xFF0C;&#x6CE8;&#x518C;&#x622A;&#x5C4F;&#x5FEB;&#x6377;&#x952E;&#xFF0C;&#x8FD9;&#x91CC;&#x662F;ctrl+shift+Q&#xFF08;QQ&#x9ED8;&#x8BA4;&#x662F;ctrl+alt+A&#xFF09;&#x3002;&#x5F53;&#x70B9;&#x51FB;&#x622A;&#x5C4F;&#x6309;&#x94AE;&#x4E4B;&#x540E;&#xFF0C;&#x5F00;&#x59CB;&#x542F;&#x52A8;&#x622A;&#x56FE;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">HWND hDesktopWnd <span class="token operator">=</span> <span class="token function">GetDesktopWindow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
HDC hScreenDC <span class="token operator">=</span> <span class="token function">GetDC</span><span class="token punctuation">(</span>hDesktopWnd<span class="token punctuation">)</span><span class="token punctuation">;</span>

RECT rc <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token number">0</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token function">GetWindowRect</span><span class="token punctuation">(</span>hDesktopWnd<span class="token punctuation">,</span> <span class="token operator">&amp;</span>rc<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">int</span> cx <span class="token operator">=</span> rc<span class="token punctuation">.</span>right <span class="token operator">-</span> rc<span class="token punctuation">.</span>left<span class="token punctuation">;</span>
<span class="token keyword">int</span> cy <span class="token operator">=</span> rc<span class="token punctuation">.</span>bottom <span class="token operator">-</span> rc<span class="token punctuation">.</span>top<span class="token punctuation">;</span>

HBITMAP hBitmap <span class="token operator">=</span> <span class="token function">CreateCompatibleBitmap</span><span class="token punctuation">(</span>hScreenDC<span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">)</span><span class="token punctuation">;</span>
m_hMemDC <span class="token operator">=</span> <span class="token function">CreateCompatibleDC</span><span class="token punctuation">(</span>hScreenDC<span class="token punctuation">)</span><span class="token punctuation">;</span>
HGDIOBJ hOldBitmap <span class="token operator">=</span> <span class="token function">SelectObject</span><span class="token punctuation">(</span>m_hMemDC<span class="token punctuation">,</span> <span class="token punctuation">(</span>HGDIOBJ<span class="token punctuation">)</span>hBitmap<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">BitBlt</span><span class="token punctuation">(</span>m_hMemDC<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">,</span> hScreenDC<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> SRCCOPY<span class="token punctuation">)</span><span class="token punctuation">;</span>

m_hBkgMemDC <span class="token operator">=</span> <span class="token function">CreateCompatibleDC</span><span class="token punctuation">(</span>hScreenDC<span class="token punctuation">)</span><span class="token punctuation">;</span>
HBITMAP hBkgBitmap <span class="token operator">=</span> <span class="token function">CreateCompatibleBitmap</span><span class="token punctuation">(</span>hScreenDC<span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">SelectObject</span><span class="token punctuation">(</span>m_hBkgMemDC<span class="token punctuation">,</span> <span class="token punctuation">(</span>HGDIOBJ<span class="token punctuation">)</span>hBkgBitmap<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">BitBlt</span><span class="token punctuation">(</span>m_hBkgMemDC<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">,</span> hScreenDC<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> SRCCOPY<span class="token punctuation">)</span><span class="token punctuation">;</span>

HDC hMaskDC <span class="token operator">=</span> <span class="token function">CreateCompatibleDC</span><span class="token punctuation">(</span>hScreenDC<span class="token punctuation">)</span><span class="token punctuation">;</span>
HBITMAP hMaskBitmap <span class="token operator">=</span> <span class="token function">CreateCompatibleBitmap</span><span class="token punctuation">(</span>hScreenDC<span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">SelectObject</span><span class="token punctuation">(</span>hMaskDC<span class="token punctuation">,</span> <span class="token punctuation">(</span>HGDIOBJ<span class="token punctuation">)</span>hMaskBitmap<span class="token punctuation">)</span><span class="token punctuation">;</span>

BLENDFUNCTION ftn <span class="token operator">=</span> <span class="token punctuation">{</span> AC_SRC_OVER<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token function">AlphaBlend</span><span class="token punctuation">(</span>m_hBkgMemDC<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">,</span> hMaskDC<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">,</span> ftn<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">DeleteObject</span><span class="token punctuation">(</span>hMaskBitmap<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">DeleteDC</span><span class="token punctuation">(</span>hMaskDC<span class="token punctuation">)</span><span class="token punctuation">;</span>

m_hDrawMemDC <span class="token operator">=</span> <span class="token function">CreateCompatibleDC</span><span class="token punctuation">(</span>hScreenDC<span class="token punctuation">)</span><span class="token punctuation">;</span>
HBITMAP hDrawBitmap <span class="token operator">=</span> <span class="token function">CreateCompatibleBitmap</span><span class="token punctuation">(</span>hScreenDC<span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">SelectObject</span><span class="token punctuation">(</span>m_hDrawMemDC<span class="token punctuation">,</span> hDrawBitmap<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token function">ReleaseDC</span><span class="token punctuation">(</span>hDesktopWnd<span class="token punctuation">,</span> hScreenDC<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x5B9E;&#x9645;&#x4E0A;&#x5C31;&#x662F;&#x5728;&#x684C;&#x9762;&#x7A97;&#x53E3;&#x4E0A;&#x753B;&#x56FE;&#x3002;&#x518D;&#x904D;&#x5386;&#x5F53;&#x524D;&#x6240;&#x6709;&#x6709;&#x663E;&#x793A;&#x533A;&#x57DF;&#x7684;&#x7A97;&#x53E3;&#xFF0C;&#x5E76;&#x8BB0;&#x5F55;&#x8FD9;&#x4E9B;&#x7A97;&#x53E3;&#x7684;&#x7A97;&#x53E3;&#x53E5;&#x67C4;&#x548C;&#x77E9;&#x5F62;&#x533A;&#x57DF;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">for</span> <span class="token punctuation">(</span>HWND hWnd <span class="token operator">=</span> <span class="token function">GetTopWindow</span><span class="token punctuation">(</span><span class="token constant">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token constant">NULL</span> <span class="token operator">!=</span> hWnd<span class="token punctuation">;</span> hWnd <span class="token operator">=</span> <span class="token function">GetWindow</span><span class="token punctuation">(</span>hWnd<span class="token punctuation">,</span> GW_HWNDNEXT<span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token function">IsWindow</span><span class="token punctuation">(</span>hWnd<span class="token punctuation">)</span>
        <span class="token operator">||</span> <span class="token operator">!</span><span class="token function">IsWindowVisible</span><span class="token punctuation">(</span>hWnd<span class="token punctuation">)</span>
        <span class="token operator">||</span> <span class="token function">IsIconic</span><span class="token punctuation">(</span>hWnd<span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">continue</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    RECT rcWnd <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token number">0</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>
    <span class="token function">GetWindowRect</span><span class="token punctuation">(</span>hWnd<span class="token punctuation">,</span> <span class="token operator">&amp;</span>rcWnd<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">adjustRectInScreen</span><span class="token punctuation">(</span>rcWnd<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token class-name">ScreenCommon</span><span class="token operator">::</span><span class="token function">isRectEmpty</span><span class="token punctuation">(</span>rcWnd<span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">continue</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">wchar_t</span> szTxt<span class="token punctuation">[</span>MAX_PATH<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token number">0</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>
    <span class="token function">GetWindowText</span><span class="token punctuation">(</span>hWnd<span class="token punctuation">,</span> szTxt<span class="token punctuation">,</span> MAX_PATH<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token function">wcslen</span><span class="token punctuation">(</span>szTxt<span class="token punctuation">)</span> <span class="token operator">&lt;=</span> <span class="token number">0</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">continue</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token comment">//combine the rect with the screen rect</span>
    m_lsWndList<span class="token punctuation">.</span><span class="token function">push_back</span><span class="token punctuation">(</span><span class="token function">ScreenCaptureWndInfo</span><span class="token punctuation">(</span>hWnd<span class="token punctuation">,</span> rcWnd<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token keyword">return</span> m_lsWndList<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">&gt;</span> <span class="token number">0</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x7136;&#x540E;&#x663E;&#x793A;&#x4E00;&#x4E2A;&#x622A;&#x56FE;&#x5DE5;&#x5177;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">BOOL <span class="token class-name">UIScreenCaptureMgr</span><span class="token operator">::</span><span class="token function">createWindows</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    m_hBkgUI <span class="token operator">=</span> <span class="token class-name">BkgroundUI</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">createWindow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">wchar_t</span> szImg<span class="token punctuation">[</span>MAX_PATH<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
    <span class="token function">GetModuleFileName</span><span class="token punctuation">(</span><span class="token constant">NULL</span><span class="token punctuation">,</span> szImg<span class="token punctuation">,</span> MAX_PATH<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">PathRemoveFileSpec</span><span class="token punctuation">(</span>szImg<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">PathRemoveFileSpec</span><span class="token punctuation">(</span>szImg<span class="token punctuation">)</span><span class="token punctuation">;</span>

    std<span class="token operator">::</span>wstring strBkgPic <span class="token operator">=</span> std<span class="token operator">::</span><span class="token function">wstring</span><span class="token punctuation">(</span>szImg<span class="token punctuation">)</span> <span class="token operator">+</span> L<span class="token string">&quot;\\gui\\ScreenCapture\\sc_toolbar_normal.png&quot;</span><span class="token punctuation">;</span>
    std<span class="token operator">::</span>wstring strHoverPic <span class="token operator">=</span> std<span class="token operator">::</span><span class="token function">wstring</span><span class="token punctuation">(</span>szImg<span class="token punctuation">)</span> <span class="token operator">+</span> L<span class="token string">&quot;\\gui\\ScreenCapture\\sc_toolbar_hover.png&quot;</span><span class="token punctuation">;</span>
    std<span class="token operator">::</span>wstring strSelPic <span class="token operator">=</span> std<span class="token operator">::</span><span class="token function">wstring</span><span class="token punctuation">(</span>szImg<span class="token punctuation">)</span> <span class="token operator">+</span> L<span class="token string">&quot;\\gui\\ScreenCapture\\sc_toolbar_select.png&quot;</span><span class="token punctuation">;</span>


    EditToolbarInfo toolBarInfo <span class="token operator">=</span> <span class="token punctuation">{</span>
        <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">193</span><span class="token punctuation">,</span> <span class="token number">37</span><span class="token punctuation">,</span>
        strBkgPic<span class="token punctuation">,</span>
        strHoverPic<span class="token punctuation">,</span>
        strSelPic<span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token punctuation">{</span> <span class="token number">9</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">35</span><span class="token punctuation">,</span> <span class="token number">31</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token punctuation">{</span> <span class="token number">43</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">69</span><span class="token punctuation">,</span> <span class="token number">31</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token punctuation">{</span> <span class="token number">85</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">112</span><span class="token punctuation">,</span> <span class="token number">31</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token punctuation">{</span> <span class="token number">119</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">185</span><span class="token punctuation">,</span> <span class="token number">31</span> <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">;</span>

    m_hEditToolBarUI <span class="token operator">=</span> <span class="token class-name">EditToolbarUI</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">createWindow</span><span class="token punctuation">(</span>toolBarInfo<span class="token punctuation">,</span> m_hBkgUI<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">SetWindowPos</span><span class="token punctuation">(</span>m_hBkgUI<span class="token punctuation">,</span> HWND_TOPMOST<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> SWP_NOSIZE <span class="token operator">|</span> SWP_NOMOVE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">forceForgroundWindow</span><span class="token punctuation">(</span>m_hBkgUI<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">ShowWindow</span><span class="token punctuation">(</span>m_hBkgUI<span class="token punctuation">,</span> SW_SHOW<span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">return</span> TRUE<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x7136;&#x540E;&#x5B89;&#x88C5;&#x4E00;&#x4E2A;&#x6D88;&#x606F;&#x94A9;&#x5B50;&#xFF08;hook&#xFF09;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp">BOOL <span class="token class-name">ScreenCapture</span><span class="token operator">::</span><span class="token function">installMsgHook</span><span class="token punctuation">(</span>BOOL bInstall<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    BOOL result <span class="token operator">=</span> FALSE<span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>bInstall<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>m_hMouseHook<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            m_hMouseHook <span class="token operator">=</span> <span class="token function">SetWindowsHookEx</span><span class="token punctuation">(</span>WH_MOUSE<span class="token punctuation">,</span> MouseProc<span class="token punctuation">,</span> <span class="token constant">NULL</span><span class="token punctuation">,</span> <span class="token function">GetCurrentThreadId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            result <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token constant">NULL</span> <span class="token operator">!=</span> m_hMouseHook<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span>
    <span class="token punctuation">{</span>
        <span class="token function">UnhookWindowsHookEx</span><span class="token punctuation">(</span>m_hMouseHook<span class="token punctuation">)</span><span class="token punctuation">;</span>
        m_hMouseHook <span class="token operator">=</span> <span class="token constant">NULL</span><span class="token punctuation">;</span>
        result <span class="token operator">=</span> TRUE<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">return</span> result<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp">LRESULT <span class="token class-name">ScreenCapture</span><span class="token operator">::</span><span class="token function">MouseProc</span><span class="token punctuation">(</span>_In_ <span class="token keyword">int</span> nCode<span class="token punctuation">,</span> _In_ WPARAM wParam<span class="token punctuation">,</span> _In_ LPARAM lParam<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    PMOUSEHOOKSTRUCT pHookInfo <span class="token operator">=</span> <span class="token punctuation">(</span>PMOUSEHOOKSTRUCT<span class="token punctuation">)</span>lParam<span class="token punctuation">;</span>
    <span class="token keyword">int</span> xPos <span class="token operator">=</span> pHookInfo<span class="token operator">-&gt;</span>pt<span class="token punctuation">.</span>x<span class="token punctuation">;</span>
    <span class="token keyword">int</span> yPos <span class="token operator">=</span> pHookInfo<span class="token operator">-&gt;</span>pt<span class="token punctuation">.</span>y<span class="token punctuation">;</span>

    LRESULT lResHandled <span class="token operator">=</span> <span class="token function">CallNextHookEx</span><span class="token punctuation">(</span><span class="token class-name">ScreenCapture</span><span class="token operator">::</span><span class="token function">getInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getMouseHook</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> nCode<span class="token punctuation">,</span> wParam<span class="token punctuation">,</span> lParam<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>WM_LBUTTONDBLCLK <span class="token operator">==</span> wParam <span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token class-name">ScreenCommon</span><span class="token operator">::</span><span class="token function">postNotifyMessage</span><span class="token punctuation">(</span>WM_SNAPSHOT_FINISH_CAPTURE<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>WM_RBUTTONDBLCLK <span class="token operator">==</span> wParam<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token class-name">ScreenCommon</span><span class="token operator">::</span><span class="token function">postNotifyMessage</span><span class="token punctuation">(</span>WM_SNAPSHOT_CANCEL_CPATURE<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>WM_LBUTTONDOWN <span class="token operator">==</span> wParam<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>CM_AUTO_SELECT <span class="token operator">==</span> <span class="token class-name">CaptureModeMgr</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">getMode</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token class-name">CaptureModeMgr</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">changeMode</span><span class="token punctuation">(</span>CM_MANAL_SELECT<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

    <span class="token class-name">CaptureModeMgr</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">handleMouseMsg</span><span class="token punctuation">(</span>wParam<span class="token punctuation">,</span> xPos<span class="token punctuation">,</span> yPos<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> lResHandled<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x5728;&#x94A9;&#x5B50;&#x51FD;&#x6570;&#x4E2D;&#xFF0C;&#x5982;&#x679C;&#x51FA;&#x73B0;&#x9F20;&#x6807;&#x53CC;&#x51FB;&#x4E8B;&#x4EF6;&#xFF0C;&#x5219;&#x8868;&#x793A;&#x53D6;&#x6D88;&#x622A;&#x56FE;&#xFF1B;&#x5982;&#x679C;&#x51FA;&#x73B0;&#x53CC;&#x51FB;&#x4E8B;&#x4EF6;&#xFF0C;&#x5219;&#x8868;&#x793A;&#x5B8C;&#x6210;&#x622A;&#x56FE;&#x3002;&#x5982;&#x679C;&#x9F20;&#x6807;&#x6309;&#x4E0B;&#x5219;&#x8868;&#x793A;&#x5F00;&#x59CB;&#x7ED8;&#x5236;&#x622A;&#x56FE;&#x533A;&#x57DF;&#xFF0C;&#x7136;&#x540E;&#x5904;&#x7406;&#x9F20;&#x6807;&#x79FB;&#x52A8;&#x4E8B;&#x4EF6;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">CaptureModeMgr</span><span class="token operator">::</span><span class="token function">handleMouseMsg</span><span class="token punctuation">(</span>__in UINT uMsg<span class="token punctuation">,</span> __in <span class="token keyword">int</span> xPos<span class="token punctuation">,</span> __in <span class="token keyword">int</span> yPos<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    IModeMsgHandler <span class="token operator">*</span>msgHandler <span class="token operator">=</span> <span class="token function">getModeHandler</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>msgHandler<span class="token punctuation">)</span> <span class="token keyword">return</span><span class="token punctuation">;</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span>WM_MOUSEMOVE <span class="token operator">==</span> uMsg<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        msgHandler<span class="token operator">-&gt;</span><span class="token function">onMouseMove</span><span class="token punctuation">(</span>xPos<span class="token punctuation">,</span> yPos<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>WM_LBUTTONDOWN <span class="token operator">==</span> uMsg<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        msgHandler<span class="token operator">-&gt;</span><span class="token function">onLButtonDown</span><span class="token punctuation">(</span>xPos<span class="token punctuation">,</span> yPos<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>WM_LBUTTONUP <span class="token operator">==</span> uMsg<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        msgHandler<span class="token operator">-&gt;</span><span class="token function">onLButtonUp</span><span class="token punctuation">(</span>xPos<span class="token punctuation">,</span> yPos<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>WM_LBUTTONDBLCLK <span class="token operator">==</span> uMsg<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        msgHandler<span class="token operator">-&gt;</span><span class="token function">onLButtonDBClick</span><span class="token punctuation">(</span>xPos<span class="token punctuation">,</span> yPos<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x9009;&#x53D6;&#x533A;&#x57DF;&#x7ED3;&#x675F;&#x65F6;&#xFF0C;&#x5C06;&#x9009;&#x62E9;&#x7684;&#x533A;&#x57DF;&#x4FDD;&#x5B58;&#x4E3A;&#x4F4D;&#x56FE;&#x5E76;&#x5B58;&#x81F3;&#x67D0;&#x4E2A;&#x8DEF;&#x5F84;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">void</span> <span class="token class-name">ScreenCapture</span><span class="token operator">::</span><span class="token function">finishCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    RECT rcSelect <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
    <span class="token class-name">UIScreenCaptureMgr</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">sendBkgMessage</span><span class="token punctuation">(</span>WM_SNAPSHOT_TEST_SELECT_RECT<span class="token punctuation">,</span> <span class="token punctuation">(</span>WPARAM<span class="token punctuation">)</span><span class="token operator">&amp;</span>rcSelect<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    rcSelect<span class="token punctuation">.</span>left <span class="token operator">+=</span> <span class="token number">2</span><span class="token punctuation">;</span>
    rcSelect<span class="token punctuation">.</span>top <span class="token operator">+=</span> <span class="token number">2</span><span class="token punctuation">;</span>
    rcSelect<span class="token punctuation">.</span>right <span class="token operator">-=</span> <span class="token number">2</span><span class="token punctuation">;</span>
    rcSelect<span class="token punctuation">.</span>bottom <span class="token operator">-=</span> <span class="token number">2</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token class-name">ScreenCommon</span><span class="token operator">::</span><span class="token function">isRectEmpty</span><span class="token punctuation">(</span>rcSelect<span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token class-name">ScreenSnapshot</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">saveRect</span><span class="token punctuation">(</span>rcSelect<span class="token punctuation">,</span> m_strSavePath<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token function">cancelCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>m_callBack<span class="token punctuation">)</span> m_callBack<span class="token operator">-&gt;</span><span class="token function">onScreenCaptureFinish</span><span class="token punctuation">(</span>m_strSavePath<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>    RECT rcSelect <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
    <span class="token class-name">UIScreenCaptureMgr</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">sendBkgMessage</span><span class="token punctuation">(</span>WM_SNAPSHOT_TEST_SELECT_RECT<span class="token punctuation">,</span> <span class="token punctuation">(</span>WPARAM<span class="token punctuation">)</span><span class="token operator">&amp;</span>rcSelect<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    rcSelect<span class="token punctuation">.</span>left <span class="token operator">+=</span> <span class="token number">2</span><span class="token punctuation">;</span>
    rcSelect<span class="token punctuation">.</span>top <span class="token operator">+=</span> <span class="token number">2</span><span class="token punctuation">;</span>
    rcSelect<span class="token punctuation">.</span>right <span class="token operator">-=</span> <span class="token number">2</span><span class="token punctuation">;</span>
    rcSelect<span class="token punctuation">.</span>bottom <span class="token operator">-=</span> <span class="token number">2</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token class-name">ScreenCommon</span><span class="token operator">::</span><span class="token function">isRectEmpty</span><span class="token punctuation">(</span>rcSelect<span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        <span class="token class-name">ScreenSnapshot</span><span class="token operator">::</span><span class="token function">Instance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-&gt;</span><span class="token function">saveRect</span><span class="token punctuation">(</span>rcSelect<span class="token punctuation">,</span> m_strSavePath<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token function">cancelCapture</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>m_callBack<span class="token punctuation">)</span> m_callBack<span class="token operator">-&gt;</span><span class="token function">onScreenCaptureFinish</span><span class="token punctuation">(</span>m_strSavePath<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<pre class="language-"><code class="lang-cpp">BOOL <span class="token class-name">ScreenSnapshot</span><span class="token operator">::</span><span class="token function">saveRect</span><span class="token punctuation">(</span>__in RECT <span class="token operator">&amp;</span>rc<span class="token punctuation">,</span> __in std<span class="token operator">::</span>wstring <span class="token operator">&amp;</span>savePath<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token function">snapshotScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    CxImage img<span class="token punctuation">;</span>
    <span class="token keyword">int</span> cx <span class="token operator">=</span> rc<span class="token punctuation">.</span>right <span class="token operator">-</span> rc<span class="token punctuation">.</span>left<span class="token punctuation">;</span>
    <span class="token keyword">int</span> cy <span class="token operator">=</span> rc<span class="token punctuation">.</span>bottom <span class="token operator">-</span> rc<span class="token punctuation">.</span>top<span class="token punctuation">;</span>

    HDC hSaveDC <span class="token operator">=</span> <span class="token function">CreateCompatibleDC</span><span class="token punctuation">(</span>m_hMemDC<span class="token punctuation">)</span><span class="token punctuation">;</span>
    HBITMAP hBitmap <span class="token operator">=</span> <span class="token function">CreateCompatibleBitmap</span><span class="token punctuation">(</span>m_hMemDC<span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">)</span><span class="token punctuation">;</span>
    HBITMAP hSaveBitmap <span class="token operator">=</span> <span class="token punctuation">(</span>HBITMAP<span class="token punctuation">)</span><span class="token function">SelectObject</span><span class="token punctuation">(</span>hSaveDC<span class="token punctuation">,</span> <span class="token punctuation">(</span>HGDIOBJ<span class="token punctuation">)</span>hBitmap<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">BitBlt</span><span class="token punctuation">(</span>hSaveDC<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> cx<span class="token punctuation">,</span> cy<span class="token punctuation">,</span> m_hMemDC<span class="token punctuation">,</span> rc<span class="token punctuation">.</span>left<span class="token punctuation">,</span> rc<span class="token punctuation">.</span>top<span class="token punctuation">,</span> SRCCOPY<span class="token punctuation">)</span><span class="token punctuation">;</span>
    hBitmap <span class="token operator">=</span> <span class="token punctuation">(</span>HBITMAP<span class="token punctuation">)</span><span class="token function">SelectObject</span><span class="token punctuation">(</span>hSaveDC<span class="token punctuation">,</span> <span class="token punctuation">(</span>HBITMAP<span class="token punctuation">)</span>hSaveBitmap<span class="token punctuation">)</span><span class="token punctuation">;</span>

    BOOL result <span class="token operator">=</span> FALSE<span class="token punctuation">;</span>
    <span class="token keyword">do</span> 
    <span class="token punctuation">{</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>img<span class="token punctuation">.</span><span class="token function">CreateFromHBITMAP</span><span class="token punctuation">(</span>hBitmap<span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>img<span class="token punctuation">.</span><span class="token function">Save</span><span class="token punctuation">(</span>savePath<span class="token punctuation">.</span><span class="token function">c_str</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> CXIMAGE_FORMAT_BMP<span class="token punctuation">)</span><span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        result <span class="token operator">=</span> TRUE<span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">while</span> <span class="token punctuation">(</span>FALSE<span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token function">DeleteObject</span><span class="token punctuation">(</span><span class="token punctuation">(</span>HGDIOBJ<span class="token punctuation">)</span>hBitmap<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">DeleteDC</span><span class="token punctuation">(</span>hSaveDC<span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">return</span> result<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x6CE8;&#x610F;&#x6574;&#x4E2A;&#x8FC7;&#x7A0B;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x4E2A;&#x795E;&#x5947;&#x7684;windows API&#xFF0C;&#x4F60;&#x6CA1;&#x770B;&#x9519;&#xFF0C;&#x5B83;&#x53EB;mouse_event&#xFF0C;&#x5F88;&#x5C11;&#x6709;windows API&#x957F;&#x6210;&#x8FD9;&#x4E2A;&#x6837;&#x5B50;&#x3002;&#x5229;&#x7528;&#x8FD9;&#x4E2A;api&#x53EF;&#x4EE5;&#x7528;&#x7A0B;&#x5E8F;&#x6A21;&#x62DF;&#x9F20;&#x6807;&#x5F88;&#x591A;&#x4E8B;&#x4EF6;&#xFF0C;&#x540E;&#x9762;&#x6709;&#x65F6;&#x95F4;&#x6211;&#x4F1A;&#x4E13;&#x95E8;&#x4ECB;&#x7ECD;&#x4E00;&#x4E0B;&#x8FD9;&#x4E2A;&#x6709;&#x7528;&#x7684;API&#x51FD;&#x6570;&#x3002;&#x5F53;&#x7136;&#xFF0C;&#x5173;&#x4E8E;&#x622A;&#x56FE;&#x7684;&#x63CF;&#x8FF0;&#xFF0C;&#x4F60;&#x53EF;&#x80FD;&#x6709;&#x70B9;&#x8FF7;&#x7CCA;&#x3002;&#x6CA1;&#x5173;&#x7CFB;&#xFF0C;&#x540E;&#x9762;&#x6211;&#x4F1A;&#x4E13;&#x95E8;&#x5199;&#x4E00;&#x7BC7;&#x6587;&#x7AE0;&#x7EC6;&#x81F4;&#x5730;&#x63A2;&#x7A76;&#x4E0B;teamtalk&#x7684;&#x5C4F;&#x5E55;&#x622A;&#x56FE;&#x6548;&#x679C;&#x5B9E;&#x73B0;&#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x91CC;&#x9762;&#x6709;&#x4EF7;&#x503C;&#x7684;&#x4E1C;&#x897F;&#x5F88;&#x591A;&#x3002;</p>
<ol>
<li>&#x7EBF;&#x7A0B;&#x7684;&#x521B;&#x5EFA;</li>
</ol>
<pre class="language-"><code class="lang-cpp">IMCoreErrorCode <span class="token class-name">OperationManager</span><span class="token operator">::</span><span class="token function">startup</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    m_operationThread <span class="token operator">=</span> std<span class="token operator">::</span><span class="token function">thread</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token operator">&amp;</span><span class="token punctuation">]</span>
    <span class="token punctuation">{</span>
        std<span class="token operator">::</span>unique_lock <span class="token operator">&lt;</span>std<span class="token operator">::</span>mutex<span class="token operator">&gt;</span> <span class="token function">lck</span><span class="token punctuation">(</span>m_cvMutex<span class="token punctuation">)</span><span class="token punctuation">;</span>
        Operation<span class="token operator">*</span> pOperation <span class="token operator">=</span> <span class="token keyword">nullptr</span><span class="token punctuation">;</span>
        <span class="token keyword">while</span> <span class="token punctuation">(</span>m_bContinue<span class="token punctuation">)</span>
        <span class="token punctuation">{</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>m_bContinue<span class="token punctuation">)</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>m_vecRealtimeOperations<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
                m_CV<span class="token punctuation">.</span><span class="token function">wait</span><span class="token punctuation">(</span>lck<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>m_bContinue<span class="token punctuation">)</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token punctuation">{</span>
                std<span class="token operator">::</span>lock_guard<span class="token operator">&lt;</span>std<span class="token operator">::</span>mutex<span class="token operator">&gt;</span> <span class="token function">lock</span><span class="token punctuation">(</span>m_mutexOperation<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span>m_vecRealtimeOperations<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
                    <span class="token keyword">continue</span><span class="token punctuation">;</span>
                pOperation <span class="token operator">=</span> m_vecRealtimeOperations<span class="token punctuation">.</span><span class="token function">front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                m_vecRealtimeOperations<span class="token punctuation">.</span><span class="token function">pop_front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>

            <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>m_bContinue<span class="token punctuation">)</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>

            <span class="token keyword">if</span> <span class="token punctuation">(</span>pOperation<span class="token punctuation">)</span>
            <span class="token punctuation">{</span>
                pOperation<span class="token operator">-&gt;</span><span class="token function">process</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                pOperation<span class="token operator">-&gt;</span><span class="token function">release</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">return</span> IMCORE_OK<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x8FD9;&#x662F;&#x5229;&#x7528;lamda&#x8868;&#x8FBE;&#x5F0F;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x7EBF;&#x7A0B;&#x5178;&#x578B;&#x7684;&#x8BED;&#x6CD5;&#xFF0C;&#x5176;&#x4E2D;m_operationThread&#x662F;&#x4E00;&#x4E2A;&#x6210;&#x5458;&#x53D8;&#x91CF;&#xFF0C;&#x7C7B;&#x578B;&#x662F;std::thread&#xFF0C;std::thread([&amp;]&#x4E2D;&#x62EC;&#x53F7;&#x4E2D;&#x7684;&amp;&#x7B26;&#x53F7;&#x8868;&#x793A;&#x8BE5;lamda&#x8868;&#x8FBE;&#x5F0F;&#x4EE5;&#x5F15;&#x7528;&#x7684;&#x65B9;&#x5F0F;&#x6355;&#x83B7;&#x4E86;&#x6240;&#x6709;&#x5916;&#x90E8;&#x7684;&#x81EA;&#x52A8;&#x53D8;&#x91CF;&#xFF0C;&#x8FD9;&#x662F;&#x5728;&#x4E00;&#x4E2A;&#x6210;&#x5458;&#x51FD;&#x6570;&#x91CC;&#x9762;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#x5728;&#x7EBF;&#x7A0B;&#x51FD;&#x6570;&#x91CC;&#x9762;&#x53EF;&#x4EE5;&#x4EE5;&#x5F15;&#x7528;&#x7684;&#x65B9;&#x5F0F;&#x4F7F;&#x7528;&#x8BE5;&#x7C7B;&#x7684;&#x6240;&#x6709;&#x6210;&#x5458;&#x53D8;&#x91CF;&#x3002;&#x8FD9;&#x4E2A;&#x8BED;&#x6CD5;&#x503C;&#x5F97;&#x5927;&#x5BB6;&#x5B66;&#x4E60;&#x3002;</p>
<ol>
<li>teamtalk&#x7684;httpclient&#x5DE5;&#x7A0B;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x62FF;&#x6765;&#x4F7F;&#x7528;&#xFF0C;&#x4F5C;&#x8005;&#x4E3B;&#x9875;&#xFF1A;<a href="http://xiangwangfeng.com&#xFF0C;github&#x94FE;&#x63A5;&#xFF1A;https://github.com/xiangwangfeng/httpclient&#x3002;" target="_blank">http://xiangwangfeng.com&#xFF0C;github&#x94FE;&#x63A5;&#xFF1A;https://github.com/xiangwangfeng/httpclient&#x3002;</a></li>
</ol>
<p>&#x53E6;&#x5916;teamtalk pc&#x7AEF;&#x5927;&#x91CF;&#x4F7F;&#x7528;C++11&#x7684;&#x8BED;&#x6CD5;&#x548C;&#x4E00;&#x4E9B;&#x66FF;&#x4EE3;&#x539F;&#x6765;&#x5E73;&#x5E38;&#x7684;&#x5199;&#x6CD5;&#xFF0C;&#x8FD9;&#x4E2A;&#x5C31;&#x4E0D;&#x4E13;&#x95E8;&#x5217;&#x51FA;&#x6765;&#x4E86;&#xFF0C;&#x540E;&#x9762;&#x6211;&#x5C06;&#x4F1A;&#x4E13;&#x95E8;&#x5199;&#x4E00;&#x7BC7;&#x6587;&#x7AE0;&#x6765;&#x4ECB;&#x7ECD;C++11&#x4E2D;&#x90A3;&#x4E9B;&#x597D;&#x7528;&#x7684;&#x5DE5;&#x7A0B;&#x7EA7;&#x6280;&#x5DE7;&#x3002;</p>
<p>&#x597D;&#x4E86;&#xFF0C;&#x8FD9;&#x7BC7;&#x6587;&#x7AE0;&#x5C31;&#x5230;&#x6B64;&#x4E3A;&#x6B62;&#x4E86;&#x3002;&#x9650;&#x4E8E;&#x4F5C;&#x8005;&#x6C34;&#x5E73;&#x6709;&#x9650;&#xFF0C;&#x6587;&#x4E2D;&#x96BE;&#x514D;&#x6709;&#x9519;&#x6F0F;&#x548C;&#x4E0D;&#x8DB3;&#xFF0C;&#x6B22;&#x8FCE;&#x6279;&#x8BC4;&#x6307;&#x6B63;&#x3002;<img src="" alt="&#x70B9;&#x51FB;&#x5E76;&#x62D6;&#x62FD;&#x4EE5;&#x79FB;&#x52A8;"> </p>
<footer class="page-footer"><span class="copyright">&#x5982;&#x9700;&#x4E0B;&#x8F7D;&#x672C;&#x7AD9;&#x5168;&#x90E8;&#x6280;&#x672F;&#x6587;&#x7AE0;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x3010;&#x9AD8;&#x6027;&#x80FD;&#x670D;&#x52A1;&#x5668;&#x5F00;&#x53D1;&#x3011;&#x516C;&#x4F17;&#x53F7;&#x56DE;&#x590D;&#x5173;&#x952E;&#x5B57;&#x201C;&#x6587;&#x7AE0;&#x4E0B;&#x8F7D;&#x201D;&#x5373;&#x53EF;&#x3002;</span><span class="footer-modification">&#x6700;&#x8FD1;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2020-10-04 15:27:20
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
						
					</section>
					
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

				</div>
			</div>
			
		</div>

		
		
		<a href="10开放一个TeamTalk测试服务器地址和几个测试账号.html" class="navigation navigation-prev " aria-label="Previous page: 10 开放一个TeamTalk测试服务器地址和几个测试账号">
			<i class="fa fa-angle-left"></i>
		</a>
		
		
		<a href="../libevent源码深度剖析/" class="navigation navigation-next " aria-label="Next page: libevent源码深度剖析">
			<i class="fa fa-angle-right"></i>
		</a>
		
		
		
	</div>
	<script>
		var gitbook = gitbook || [];
		gitbook.push(function() {
			gitbook.page.hasChanged({"page":{"title":"11 pc客户端源码分析","level":"6.1.11","depth":2,"next":{"title":"libevent源码深度剖析","level":"7.1","depth":1,"path":"articles/libevent源码深度剖析/index.md","ref":"articles/libevent源码深度剖析/index.md","articles":[{"title":"libevent源码深度剖析01","level":"7.1.1","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析01.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析01.md","articles":[]},{"title":"libevent源码深度剖析02","level":"7.1.2","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析02.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析02.md","articles":[]},{"title":"libevent源码深度剖析03","level":"7.1.3","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析03.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析03.md","articles":[]},{"title":"libevent源码深度剖析04","level":"7.1.4","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析04.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析04.md","articles":[]},{"title":"libevent源码深度剖析05","level":"7.1.5","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析05.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析05.md","articles":[]},{"title":"libevent源码深度剖析06","level":"7.1.6","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析06.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析06.md","articles":[]},{"title":"libevent源码深度剖析07","level":"7.1.7","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析07.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析07.md","articles":[]},{"title":"libevent源码深度剖析08","level":"7.1.8","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析08.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析08.md","articles":[]},{"title":"libevent源码深度剖析09","level":"7.1.9","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析09.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析09.md","articles":[]},{"title":"libevent源码深度剖析10","level":"7.1.10","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析10.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析10.md","articles":[]},{"title":"libevent源码深度剖析11","level":"7.1.11","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析11.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析11.md","articles":[]},{"title":"libevent源码深度剖析12","level":"7.1.12","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析12.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析12.md","articles":[]},{"title":"libevent源码深度剖析13","level":"7.1.13","depth":2,"path":"articles/libevent源码深度剖析/libevent源码深度剖析13.md","ref":"articles/libevent源码深度剖析/libevent源码深度剖析13.md","articles":[]}]},"previous":{"title":"10 开放一个TeamTalk测试服务器地址和几个测试账号","level":"6.1.10","depth":2,"path":"articles/TeamTalk源码解析/10开放一个TeamTalk测试服务器地址和几个测试账号.md","ref":"articles/TeamTalk源码解析/10开放一个TeamTalk测试服务器地址和几个测试账号.md","articles":[]},"dir":"ltr"},"config":{"plugins":["chapter-fold","-lunr","-search","search-pro","splitter","popup","back-to-top-button","hide-element","prism","-highlight","tbfed-pagefooter","code","anchor-navigation-ex","theme-fexa","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"如需下载本站全部技术文章，可以在【高性能服务器开发】公众号回复关键字“文章下载”即可。","modify_label":"最近更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"prism":{},"livereload":{},"splitter":{},"search-pro":{},"popup":{},"theme-fexa":{"search-placeholder":"输入关键字搜索","logo":"./logo.png","favicon":"./favicon.ico"},"code":{"copyButtons":true},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"anchor-navigation-ex":{"showLevel":false,"associatedWithSummary":true,"mode":"float","showGoTop":false,"printLog":false,"multipleH1":true,"float":{"floatIcon":"fa fa-navicon","showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"back-to-top-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"easy_coder","pdf":{"pageBreaksBefore":"/","headerTemplate":null,"paperSize":"a4","margin":{"right":62,"left":62,"top":36,"bottom":36},"fontSize":12,"fontFamily":"Arial","footerTemplate":null,"chapterMark":"pagebreak","pageNumbers":false},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"isbn":"","variables":{},"title":"高性能服务器开发 技术专栏","links":{},"gitbook":"*","description":"","theme-default":{"showLevel":true},"extension":null},"file":{"path":"articles/TeamTalk源码解析/11pc客户端源码分析.md","mtime":"2020-10-04T07:27:20.260Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-10-09T15:31:57.905Z"},"basePath":"../..","book":{"language":""}});
		});
	</script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-fexa/fexa.js"></script>
        
    

    </body>
</html>

